-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
schema stitching question. modify initial request and pass it to remoteServer #737
Comments
@lonyele I think I was just able to solve this using Apollo Link with In your gateway:
Now Auth microservice has token available in headers. |
I don't know why I couldn't see this earlier, but It seems like It would work with your method. I'll try this soon. Thanks a lot!! |
How about something from the mergedSchemas altering headers on the response from above? @booboothefool any ideas how could I accomplish this? |
When trying to do this I always get Edit: This fixed it:
const ContextLink = setContext((request, previousContext) => ({
headers: {
authorization: previousContext.graphqlContext.headers.authorization,
}
}));
app.use(
'/graphql',
bodyParser.json(),
graphqlExpress(async request => ({
schema: await makeMergedSchema(),
context: {
headers: request ? request.headers : null
}
}))
); |
what if you want to pass in a whole context? For example, authorization server returns policies that are tied to the user, i dont want to send the token down to my stitched serve, i want to pass down the user object i set at my context. |
This might sound dumb but where is setContext() coming from? |
I struggled with this also, he is using
|
How do you use it in the service that you have stitched? |
I don't know if it's right to ask here... but I couldn't find anywhere.
There is one api gateway graphql/express server(get all the request from clients) and
multiple microservice graphql/express servers(auth, business logic1 , business logic2, business logic3 etc) that are connected to this gateway using schema stitching.(mergeSchema)
It seems like modifying request object doesn't affect anything.(it only affects the object in gateway server)
It seems like copying graphql specific data only and send it to remoteServer.(Therefore, I couldn't get the Authorization header at my remoteServer)
so far, I couldn't find a way to pass my jwt token from api gateway to other remote servers.
Am I thinking something wrong?
The text was updated successfully, but these errors were encountered: