Skip to content

Commit

Permalink
use x-api-key instead of userToken to match the v1 api
Browse files Browse the repository at this point in the history
  • Loading branch information
dalehille committed May 18, 2020
1 parent 2255d04 commit cfc017c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/apollo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ const createApolloServer = () => {
orgId = org._id;
}
let userToken;
if(connectionParams.headers && connectionParams.headers['userToken']) {
userToken = connectionParams.headers['userToken'];
if(connectionParams.headers && connectionParams.headers['x-api-key']) {
userToken = connectionParams.headers['x-api-key'];
}

logger.trace({ req_id, connectionParams, context }, 'subscriptions:onConnect');
Expand Down
2 changes: 1 addition & 1 deletion app/apollo/models/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ UserSchema.statics.getMeFromConnectionParams = async function(...args){
const getMeFromRequestBase = UserSchema.statics.getMeFromRequest;
UserSchema.statics.getMeFromRequest = async function(...args){
const [req, {models}] = args;
const userToken = req.get('userToken');
const userToken = req.get('x-api-key');

if(userToken){
return await loadMeFromUserToken.bind(this)(userToken, models);
Expand Down

0 comments on commit cfc017c

Please sign in to comment.