How can I manage invalid JWT tokens? #1249
-
Hi, I am currently trying to let my Apollo Client know that a token is invalid from the context function in graphql-yoga as follows:
My intention is to take the token from the authorization header, validate it and set the user information in the GQL server context so I can properly identify the user making a request and act accordingly. Also, if the token is invalid I wish to throw an error code of INVALID_TOKEN so the client knows it needs to take the user to the login page and have the user login so the user can continue using the app. However, any error thrown inside the context function simply ends in a 500 error code and not much information is provided to the client, here's an example of the response the client gets: Perhaps I am not doing things the right way (I've done this implementation in a GQL-express server and it works perfectly) and would like to ask for your guidance in how to proceed. Thanks a lot! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hey @oscar-corredor, this seems like a bug to me, thus I will convert this into an issue. See #1263 |
Beta Was this translation helpful? Give feedback.
Hey @oscar-corredor, this seems like a bug to me, thus I will convert this into an issue. See #1263