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
I use the custom context function that I pass in the sofa constructor (useSofa(...)), to extract the auth token and pack it into a context, so my GraphQL logic finds it. I can do this for every operation, but not for opening a subscription. When I try to subscribe from a client, I get back an unauthorized error, because of course, the context does not contain my token.
I've checked the router.ts, and there, the contextFactory is not used to create a contextValue, just purely the sofaContext is passed to the subscriptionManager.start. This is done correctly for the subscription update, and when I changed the behavior accordingly to the subscription start, my issue was fixed, the auth token could be extracted.
I would gladly create a pull request, just wanted to ask first, if this is somehow intentional, or really a bug.
Another question would be: can you propose a simple workaround that I can do on my side without having to modify the sofa code?
Thanks,
Robert
The text was updated successfully, but these errors were encountered:
Hi,
I use the custom context function that I pass in the sofa constructor (useSofa(...)), to extract the auth token and pack it into a context, so my GraphQL logic finds it. I can do this for every operation, but not for opening a subscription. When I try to subscribe from a client, I get back an unauthorized error, because of course, the context does not contain my token.
I've checked the router.ts, and there, the contextFactory is not used to create a contextValue, just purely the sofaContext is passed to the subscriptionManager.start. This is done correctly for the subscription update, and when I changed the behavior accordingly to the subscription start, my issue was fixed, the auth token could be extracted.
I would gladly create a pull request, just wanted to ask first, if this is somehow intentional, or really a bug.
Another question would be: can you propose a simple workaround that I can do on my side without having to modify the sofa code?
Thanks,
Robert
The text was updated successfully, but these errors were encountered: