Hello I'm new to GraphQl and to Apollo Server. I would like to implement authentication on my project.
But
For some reason, I can't seem to set context on my resolvers in apollo server.
Here's my index
    const server = new ApolloServer({ 
        typeDefs, 
        resolvers, 
        context: ({ req }) => {
           const userId = jwtDecode(req.headers.authorization)
           return userId.sub
        }
    })
And my query
    Query: {
        users: async (parent, args, context) => {
            try {
                console.log(context)
                return await getUsers(context)
            } catch (err) {
                console.log(err)
                throw new Error(err.message)
            }
        }
When I try to output the context the result is always like this...
{ injector:
   Injector {
     options:
      { name: 'index.ts_8346047369535445_SESSION',
        injectorScope: 'SESSION',
        hooks: [Array],
        children: [] },
     _classMap: Map {},
     _factoryMap: Map {},
     _applicationScopeInstanceMap:
      Map {
        Symbol(ModuleConfig.index.ts_8346047369535445) => undefined,
        [Function] => undefined },
     _sessionScopeInstanceMap: Map { [Function: ModuleSessionInfo] => [ModuleSessionInfo] },
     _applicationScopeServiceIdentifiers:
      [ Symbol(ModuleConfig.index.ts_8346047369535445), [Function] ],
     _requestScopeServiceIdentifiers: [],
     _sessionScopeServiceIdentifiers: [ [Function: ModuleSessionInfo] ],
     _hookServiceIdentifiersMap: Map {},
     _name: 'index.ts_8346047369535445_SESSION',
     _injectorScope: 'SESSION',
     _defaultProviderScope: 'SESSION',
........