Auth0-Apollo example has invalid idToken even with HS256
auth0 apollo example fails at login. Previous issues indicate that HS256 is the problem, i've changed that already. Here is the error message:
CreateUser.js:80 Error: GraphQL error: The provided idToken is invalid. Please see https://auth0.com/docs/tokens/id_token for how to obtain a valid idToken
I noticed in LoginAuth0.js file that authResult returns a accessToken but idToken, idTokenPayload, and refreshToken, are all undefined.
Does anyone else have this issue? what am I doing wrong? I did not make any other changes
I get the same error.
There are a few options:
- Either, disable OIDC conformance in your Auth0 client settings in the dashboard and make sure you don't set the audience. As this is both less secure and might break further down the road (Auth0s support for HS256 has decreased over time), it's the least preferred option.
- Or, use the custom authentication feature to support RS256 tokens using the new feature Resolver Functions. We've prepared an example for custom email-password authentication already, more examples will follow. If you want to try it out, please reach out in Framework Preview feedback thread that's mentioned in the README.
- Lastly, you can follow an approach similar to this one: https://github.com/graphcool/templates/pull/77 This sets up an Auth0 rule and does not require any custom setup on Graphcool's side.
Either, disable OIDC conformance in your Auth0 client settings in the dashboard and make sure you don't set the audience. As this is both less secure and might break further down the road (Auth0s support for HS256 has decreased over time), it's the least preferred option.
Thanks, @marktani 👍 This was my problem but fortunately, I've discovered it earlier! Anyway, Thanks for the response. Mind adding it in a Troubleshooting in the readme?
great, this solves my problem too.
According to react-native-auth0 docs I was setting audience but disabling it solves my problem too. Thanks @marktani
Does anyone know if this issue is any different for Facebook login with Auth0? I've followed the instructions to disable OIDC conformance and change the algorithm to HS256 but auth0 login with facebook still seems to be returning an RS256 token and so the error Error: GraphQL error: The provided idToken is invalid persists.
@Findiglay Are you sure you are using the correct URL referring to that project in Auth0?
@morajabi Can you clarify which url you refer to? I only have one auth0 client and settings seem to be correct. Authentication is working but it's always returning RS256.
@Findiglay Do you have a minimal repo or something we can check? It's almost impossible to solve the problem this way.
@Findiglay Are you setting the audience? Be sure you remove the audience settings.