Re:The GraphQL stack: How everything fits together
by stingraycharles on Thursday November 09, 2017 @03:56AM
(#15660880)
We let our GraphQL server accept a JWT authorization header, which is then propagated to all service calls it does. When the user doesn't have permission to some (sub)resources being requested, the GraphQL server doesn't see it either.
[ Parent
| on HN ]
Re:The GraphQL stack: How everything fits together
by k__ on Thursday November 09, 2017 @11:26AM
(#15663680)
But what comes back?
Lets say I request a user, his name, email and all their friends.
But I don't have access to the friends.
Now do I get nothing back and the error that my request would include data I have no access to?
Or would I get name and email, but the list of friends would be empty? would I get an additional warning somewhere so I know it's an permission problem and the user doesn't have no friends?
Would I get an inline error in the place of the friends?
Re:The GraphQL stack: How everything fits together
by cheald on Thursday November 09, 2017 @11:28AM
(#15663700)
That's entirely up to you and how you choose to implement your fields' resolutions.
Re:The GraphQL stack: How everything fits together
by k__ on Thursday November 09, 2017 @12:45PM
(#15664282)
Are there any best practices?
Re:The GraphQL stack: How everything fits together
by cheald on Thursday November 09, 2017 @01:18PM
(#15664531)
I don't know if there are for GraphQL in particular. I have my GraphQL implementation as a part of a Ruby app. graphql-ruby has this handy error handling doc: https://github.com/rmosolgo/graphql-ruby/blob/master/guides/... and there's the graphql-errors gem which sort of does this in a generic manner, allowing individual fields to fail without the whole query failing: https://github.com/exAspArk/graphql-errors