the case of the missing file
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
const createAuthHeaderFromCookie = (req, _, next) => {
|
||||
if (process.env.NODE_ENV !== 'production' || this.config.productionGraphQLPlayground) {
|
||||
const existingAuthHeader = req.get('Authorization');
|
||||
const { token } = req.cookies;
|
||||
|
||||
if (!existingAuthHeader && token) {
|
||||
req.headers.authorization = `JWT ${token}`;
|
||||
}
|
||||
}
|
||||
|
||||
next();
|
||||
};
|
||||
|
||||
module.exports = createAuthHeaderFromCookie;
|
||||
|
||||
Reference in New Issue
Block a user