I actually get the same error when using the hoste...
# prisma-whats-new
j
I actually get the same error when using the hosted version of the tutorial here... http://apollo-auth0.netlify.com/
a
@juliancurrie I think the hosted version is outdated.
I just ran through all the steps locally
The only step missing there is that you have to put your Auth0 clientId and domain in ./src/components/app.js
j
@agartha I wonder if the entire repo is outdated. I get the exact same error as the hosted version. I've done all the steps in my app. Auth0 works perfectly. I just can't add the user in the Graphcool backend
I don't think the auth provider is the issue
a
I followed everything from scratch
Based on the repo
And everything works
Did you add the callback URL to your Auth0 settings?
j
Yes. I'm past that point. Everything with Auth0 works fine. The users are there
a
So what's not working then?
j
Added the user to GraphCool after that
Adding*
the createUser mutation
a
That happens automatically
j
Copy code
const createUser = gql`
  mutation ($idToken: String!, $name: String!, $emailAddress: String!, $emailSubscription: Boolean!){
    createUser(authProvider: {
      auth0: {idToken: $idToken}
    }, 
    name: $name, 
    emailAddress: $emailAddress, 
    emailSubscription: $emailSubscription)   {
      id
    } 
  }
`;
the users dont get added to the Graphcool db. I'm looking at the console now
and I get that error
a
You must have missed a step somewhere
It literally took me 5 minutes to run through it from scratch
And it works
a
Yes
j
i don't know..The issue is related to the createUser mutation. I've been trying different things for hours
or the Graphcool backend itself
I've logged the idToken to check. It's being sent to the server fine. I wish they would tell me why it's invalid
a
You did setup Auth0 in your project like described?
This is the one I just setup from scratch
j
ok..that works
a
I followed all the steps to the letter
j
there's something I couldn't do
location.reload() location is undefined. I wasn't sure where that came from
a
Where did you get that?
I would advise you to start from scratch one more time, it takes 5-10 minutes, because it's harder to backtrack your steps.
I have just commented on https://github.com/graphcool-examples/react-graphql/issues/13 that the issue with the live demo still persists.
I think I found the issue
On Auth0, in the advanced app settings, can you check on the OAuth tab, the JsonWebToken Signature Algorithm
It needs to be HS256
If I change mine to RS256, I get exactly the same error and behavior
j
ah ok. I get the same error when i cloned the repo and entered my own credentials
a
Did you create a new app in Auth0?
j
ill try that
a
Or change the setting
For me, it was HS256 by default when creating a new app, so it worked right away
j
do you mean a new client?
i don't see an oAuth tab
a
Advanced settings
j
it's HS256 now
by default
a
That should work
The other one that doesn't work is probably on RS256?
j
no i'm saying it was already HS256
that wasn't the issue
a
Damn
Because if I change it from HS256 to RS256, I get the error, that's why...
So with the new client you created, does it work?
You have to update it in the Graphcool console, and the client
j
i didn't create a new client now
i'm using my same link, ID, and domain
i know the graph isn't the same so I'm getting issues related to that. I care more that I'm still seeing that same error before those
a
You're using the same domain and clientId in both the client (app.js) and graphcool console? did you double check?
also, double check your graphcool api endpoint in the client, to be sure you're talking to the right project
Make sure you use the simple api endpoint, not the relay
j
yep.. all that is correct
The endpoin, clientID, and domain are all pointing to my app in the code I just cloned from that repo
a
and your auth0 app contains the callback url and HS256 setting?
and in the graphcool console, you also use the same auth0 settings on the integration settings?
j
Ha..you know what..I figured out the issue
Always the simplest and stupidest mistakes..
a
Tell me, tell me...
j
So when I was copying and pasting the credentials from Auth0 over to the GraphCool console, I copied and pasted the secret as *********** instead of first revealing it and then copying it
a
There's a copy to clipboard button besides it for a reason 🙂
Well, glad it's working now 🙂
j
ha yeah, i rarely click that when I see it. Thanks for walking me through some things though. I learned a lot
👍🏻 1
a
You're welcome