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
Example client side with ApolloClient header token
Comments
@shansmith01 Have you figured out what should be the best practice? So I think the issue title could be even changed since basically we need just an example of how to properly use access token from the client side, or any clarifications about why everything should be hidden behind nextjs api routes. |
@lnikell have you found a solution by any chance? without using the proxy? |
@serendipity1004 I decided to move to https://github.com/iaincollins/next-auth and stop trying to get anything from Auth0 or their support. |
Hi all, please check out the Access an external API from an API route example from the new v1.0.0-beta.0 release. The issues #67 #55 might also be useful for Apollo Client users.
We have included information about this in the README of the new beta. |
I'm not a fan of this solution TBH (latency impact |
I really need a way to be able to just pass on the token with Apollo client, I'm doing this:
Include should include any tokens, but seems to only include cookies that are not able to be decoded. Having to add it to an /api/ route just adds a lot of unnecessary complexity, and breaks code autogeneration functionality for TypeScript, which is a no go. |
shansmith01 commentedFeb 3, 2020
Describe the problem you'd like to have solved
I am having difficulty figuring out how to use this library with Apollo Client.
Detail: I have a nextjs app with accesses an external api (hasura) which require JWT authentication. I would love a best practice example (that ideally does not use local storage) for passing a JWT token (specifically hasura uses the idToken) in the request header from apollo client
Describe the ideal solution
The ideal solution would be an example showing a best practice way to pass the token from an API route to the front end without using express and then showing what the apollo client looks like
Alternatives and current work-arounds
Note I can think of several ways to do this. Eg. have a getToken function which
What I am looking for is best preactice/secure as possible.
Sorry I am relatively newbie.
Additional context
The text was updated successfully, but these errors were encountered: