|
@@ -386,14 +386,14 @@ const anonResolvers = ['login', 'createUser'];
|
|
|
}
|
|
|
|
|
|
app.use('/graphql', express_graphql(async (req, res, gql) => {
|
|
|
- if (gql.operationName === null || anonResolvers.includes(gql.operationName))
|
|
|
+ const authorization = req.headers.authorization
|
|
|
+ if (!authorization && (gql.operationName === null || anonResolvers.includes(gql.operationName)))
|
|
|
return {
|
|
|
schema: schema,
|
|
|
rootValue: rootResolvers,
|
|
|
graphiql: true,
|
|
|
}
|
|
|
|
|
|
- const authorization = req.headers.authorization
|
|
|
if (authorization && authorization.startsWith('Bearer ')){
|
|
|
console.log('token provided')
|
|
|
const token = authorization.substr("Bearer ".length)
|