Skip to content

Commit

Permalink
Updated CORS Origin (Resolved #55)
Browse files Browse the repository at this point in the history
  • Loading branch information
stanleyowen committed Mar 17, 2021
1 parent 04dec3e commit f9d8188
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion client/src/components/login.component.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react';
import { setNotification, NOTIFICATION_TYPES } from '../libraries/setNotification';
import { createRequest, OAuthGitHub, getCookie } from '../libraries/validation';
import { createRequest, OAuthGitHub } from '../libraries/validation';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faGithub } from '@fortawesome/free-brands-svg-icons';
import Axios from 'axios';
Expand Down
8 changes: 1 addition & 7 deletions client/src/libraries/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,4 @@ const createRequest = (e) => {
.then().catch(err => console.log(err));
}

const getCookie = (name) => {
const value = `; ${document.cookie}`;
const parts = value.split(`; ${name}=`);
if (parts.length === 2) return parts.pop().split(';').shift();
}

module.exports = {labels, validateLabel, OAuthGitHub, createRequest, getCookie};
module.exports = {labels, validateLabel, OAuthGitHub, createRequest};
6 changes: 5 additions & 1 deletion server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ const csrfProtection = csrf({ cookie: true })
require('dotenv').config();
require('./config/passport');

app.use(cors());
app.use(cors({
origin: process.env.CLIENT_URL,
optionsSuccessStatus: 200,
credentials: true
}));
app.use(helmet());
app.use(express.urlencoded({ extended: true }));
app.use(cookieParser());
Expand Down

0 comments on commit f9d8188

Please sign in to comment.