I’m using the subscription pattern described in the Apollo Doc for onConnect and validation of JWT using the connectionParams. It works well when using a client that can insert the connectionParams information. However, the Apollo Sandbox does not have a user interface to insert connectionParams.
I tried to include the JWT inside the headers portion of the UI and then within the server code (onConnect) function to access the headers, but without success. No header information is provided in the onConnect argument of type GraphQLSubscriptionContext.
In the end, using the Apollo Sandbox has no way to pass credentials. Not by header, not by the cookie, and not by connectionParams.
What is the way to get authentication information using Apollo Sandbox on a Subscription connection?
@watson Thanks for the fast response. I’ve been wondering how can back-end devs simulate connectionParams for Subscriptions without bothering front-end devs and just using Apollo Sandbox, so that when it’s given to the front-end devs, it’s ready and tested and found this thread.
Just in case somebody needs to make it work while Apollo team is working on connectionParams to be added in Apollo Sandbox, I’m currently using https://altairgraphql.dev/ to develop on subscriptions as they have connectionParams.