Hey, just signed up and followed the Auth0/Apollo ...
# prisma-whats-new
a
Hey, just signed up and followed the Auth0/Apollo tutorial, but getting CORS errors. What's up? I see similar questions have been asked the last few weeks, but the reply is always "I'll follow up in a PM" (sad face)
n
@andyblack hey 🙂 good observation
@andyblack :D
a CORS issue can be caused by a lot of things, typically by a malformed query though
a
I've just used this vanilla tutorial: https://github.com/graphcool-examples/react-graphql/tree/master/authentication-with-auth0-and-apollo - I'm 99.99% sure I've filled in all the right credentials, as I can see an auth0 token in the auth0 app and my localstorage
but following the auth0 modal, once I submit the email/name/subscribe form, I'm still not logged in and get 2 errors:
Error: GraphQL error: The provided idToken is invalid. Please see <https://auth0.com/docs/tokens/id_token> for how to obtain a valid idToken
and
Fetch API cannot load <https://api.graph.cool/simple/v1/cj463cv4u0e2501219we1y4pk>. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '<http://localhost:3000>' is therefore not allowed access. The response had HTTP status code 504. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
n
ah ok. did you enter the right credentials in the Graphcool project as well?
also, is the token H256 encoded? you can check on jwt.io pasting the token
a
jwt.io says invalid token
i'll try run the tutorial from scratch again in case i've been a moron somewhere
nope. deleted/recreated everything from scratch, including new graphcool project and auth0 client, but still getting invalid idToken error:
Copy code
Error: GraphQL error: The provided idToken is invalid. Please see <https://auth0.com/docs/tokens/id_token> for how to obtain a valid idToken
    at new ApolloError (apollo.umd.js:1959)
    at apollo.umd.js:2670
    at <anonymous>
(anonymous) @ CreateUser.js:80
on the plus side(!?) not getting the 504s this time...
With the light of day, I dug into my Auth0 settings and flicked to switch to H256, and it's working now - thank you! Has Auth0 recently changed their default encoding algorithm to R256?
n
indeed they did @andyblack 🙂
t
I have been googling like a mad man for this solution. I should have joined the slack team week ago!