Trying to setup graph.cool with auth0. Is there an...
# prisma-whats-new
m
Trying to setup graph.cool with auth0. Is there anyway to receive a users (social) accesstokens? Like auth0 describes here: https://auth0.com/docs/tutorials/calling-an-external-idp-api
a
@mclovin Well, basically just follow the steps on that page.
After you setup Auth0 at Graphcool, you get an extra field auth0UserId in your User type. This is the id you need for step 2 (Auth0 Get Users by Id).
m
@agartha Thanks for the response. I agree, sadly my code is client-side so using the auth0 management api token isn;t really safe. They recommend doing this serverside. Thats why I hoped Graphcool could assist me
I try making my project serverless and use graphcool as my backend
I thought of maybe run a cronjob on graphcool (when it gets available) which refreshes users access tokenens using the docs above. only this is a bit of overhead
a
Well, you could probably do it in an event handler or subscription after create for the User type?
m
access tokens will expire in an hour so on creation wouldnt work
There isn't a handler like 'beforeGet' right?
a
Not yet. There's a feature request for that though. You could create a microservice on webtask or similar to do that though.
m
That would be ok to
Thanks for the help @agartha
👍 1
d
do you have access to these tokens in an auth0 Rule?
Rules are super powerful and allow modifying the payload provided when fetching users profile after authenticating w/ graph.cool