Skip to content

Commit

Permalink
add needed cors headers for cross origin
Browse files Browse the repository at this point in the history
ref #65
  • Loading branch information
maxgrossman committed Jul 31, 2019
1 parent bc3f437 commit 1749f2c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions routes/auth/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = {
method: 'GET',
path: '/auth/verify',
config: {
handler: function(r, h) {
handler: function (r, h) {

const { oauth_token, oauth_verifier } = r.query;

Expand All @@ -27,7 +27,7 @@ module.exports = {
}

let match = false;
for (let id of sessionsManager.sessions()) {
for (let id of sessionsManager.sessions()) {
let session = sessionsManager.get(id);
if (
session.oauth_token === oauth_token &&
Expand All @@ -46,6 +46,11 @@ module.exports = {
.response({ name: user.name, id: user.id })
.header('Content-Type', 'application/json')
.code(200);
},
cors: {
origin: ['*'],
headers: ['Accept', 'Authorization', 'Content-Type', 'If-None-Match', 'Access-Control-Allow-Origin'],
credentials: true
}
}
}),
Expand Down

0 comments on commit 1749f2c

Please sign in to comment.