sirsavary / fastify-graphql

Run an Apollo Server on Fastify.
https://www.npmjs.com/package/fastify-graphql
MIT License
24 stars 5 forks source link

How to add authentication to graphql? #11

Open annibuliful opened 6 years ago

sirsavary commented 6 years ago

Adding authentication to GraphQL is quite easy, are you looking for a more high-level guide or something integrated with a library, such as Passport?

annibuliful commented 6 years ago

I think that I will use Fastify Hook to create authentication. It's good or not?

kwalski commented 6 years ago

I have a preHandle hook which decodes a jwt and sets payload on the request. But I can't figure out how to access request object in graphql. Is there any way to pass it Inc context property of graphql options object

kwalski commented 6 years ago

Or should I set it in variables??