kkemple / graphql-auth

🔒 GraphQL authentication and authorization middleware
MIT License
278 stars 19 forks source link

Fix auth without scope closes #1 #2

Closed HaNdTriX closed 7 years ago

HaNdTriX commented 7 years ago

Thanks for this simple but powerful package!

This PR fixes the case where a dev only want's to authorize an resolver without passing in a scope:

Error:

TypeError: Cannot read property 'length' of null

Example:

...
myResolver: withAuth((_, query, context) => {
   return { foo: 1 }
})
...

Docs https://github.com/kkemple/graphql-auth#withauthscope-callback

kkemple commented 7 years ago

thank you so much for getting to this. i wanted to last weekend and just couldn't get the time!

kkemple commented 7 years ago

i have deployed a new version: 0.0.4