Can someone help me to implement authentication an...
# prisma-whats-new
r
Can someone help me to implement authentication and authorization using passport.js and graphql
t
I think that implementing the authentication logic inside graphql would make it over complicated
you should implement passport.js like you normally would and return a JWT token to use with each request to graphql endpoint
r
Okay. So you mean to say that I have to use different end points for authentication?
l
we are working on an auth0 example at the moment – should be ready for you to check out this week!
in the meantime, here’s an example with github auth: https://github.com/maticzav/graphql-server-github-auth-example/
t
yes. Graphql doesn't mean you can't have another REST endpoint
somewhere in this video, Lee Bryon talked about how facebook does auth, permission, ... with GraphQL

https://www.youtube.com/watch?v=zVNrqo9XGOs

(spoiler: GraphQL is only the data layer, everything else is solved at different layer). And I think that this approach is more easy to reason about. Because I can reuse most of the infrastructure built for REST and don't have to replicate everything for GraphQL endpoint
❤️ 1