You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The schema provides both queries which need authentication and freely accessible ones. Therefore I'm parsing the JWT up front in an express middleware. An user object is injected in the context base on the JWT payload. Authenticated queries rely on htis user object in the context.
Mutations and queries are forwarded to the correct service (e.g. login mutation) but it looks like the context (and therefore the user object) is not.
It seems to me that I am missing something fundamental.
I've tried to boil the code down to a minimal functionality:
Describe the bug
Hello,
I'm currently switching from
@apollo/server
(using schema stitching) tographql-yoga
using federation.The setup runs three subgraphs and a supergraph created by
rover
(as described in https://the-guild.dev/graphql/yoga-server/docs/features/apollo-federation#using-the-file-system). Serving is done byexpress
.The schema provides both queries which need authentication and freely accessible ones. Therefore I'm parsing the JWT up front in an express middleware. An
user
object is injected in the context base on the JWT payload. Authenticated queries rely on htisuser
object in the context.Mutations and queries are forwarded to the correct service (e.g. login mutation) but it looks like the context (and therefore the
user
object) is not.It seems to me that I am missing something fundamental.
I've tried to boil the code down to a minimal functionality:
JWT parsing works as I can see the
user
in the context:Context in the subgraph:
Your Example Website or App
Don't know how to setup a federation on CodeSandbox
Steps to Reproduce the Bug or Issue
Expected behavior
Context of gateway should be passed to subgraph
Screenshots or Videos
No response
Platform
@graphql-yoga/*
version(s):Additional context
No response
The text was updated successfully, but these errors were encountered: