Hi, I have troubles understanding the flow between...
# prisma-whats-new
w
Hi, I have troubles understanding the flow between graph.cool and Auth0. I have already integrated graph.cool with Auth0, but Im not sure how should I use the generated createUser mutation
a
Are you talking about the built-in integration for Auth0?
w
yes
a
In that case, you would use the Auth0 authentication flow (using Auth0 lock or another client), and the token you get back from Auth0 would be passed to the createUser mutation. That would create the user in Graphcool and give you the Graphcool token that you would use for subsequent requests
w
I see, so I should call the createuser mutation when the Auth0 authorization succeeds and pass to it accessToken that will be returned in credentials (I am creating iOS app) form Auth0
a
Yes
d
This doesn't sound quite like what I do with the auth0 integration. The createUser mutation returns a User object with an id but I don't need to use that id in subsequent requests (unless the query/mutation requires a user ID as a parameter) - I just use the token from auth0 in the authentication header for graphql requests to the API (this is for the simple API - may be different for relay)
So I call createUser the first time the user is authenticated but not on subsequent occasions, I just pass the auth0 token. (I use the special user query to see if the authenticated user already exists in graph.cool and decide whether createUser needs to be called)
a
@dankent you're right. I was mistaken. With the built-in Auth0 authentication you can directly pass the Auth0 token for any request to your endpoint after createUser.
d
It's a while since I wrote my auth code so I had to go and look at what it was actually doing to be sure 😉
a
I'm always using custom auth nowadays. Hadn't used the built-in once since forever...