added token loading from env vars

This commit is contained in:
Samuel Andert
2023-08-22 10:34:27 +02:00
parent c7a8449863
commit 17921cf221
3 changed files with 12 additions and 11 deletions

View File

@ -7,12 +7,11 @@ type UserType = {
const resolveUserFn = async context => {
const authHeader = context.req.headers.authorization;
if (authHeader !== "token123") {
const authtoken = process.env.GRAPHQL_MESH
if (authHeader !== authtoken) {
console.error('Failed to validate token')
return null
}
// If the token is valid, return the user
// Replace this with your actual user fetching logic
return { id: 'user1' };
}