Skip to content
This repository was archived by the owner on Jul 25, 2024. It is now read-only.

Conversation

@seanabrahams
Copy link
Member

One example of what this allows us to do is set the logged in user in
:root_value and have it available in resolve functions so we can do
authorization.

See https://github.com/graphql-elixir/graphql-elixir/wiki/How-to-do-authentication-and-authorization-in-a-Phoenix-application-with-GraphQL for example.

in other plugs make it to GraphQL context.

One example of what this allows us to do is set the logged in user in
:root_value and have it available in resolve functions so we can do
authorization.
@joshprice
Copy link
Member

Merging #24 has changed the landscape quite a bit. Suspect that the issue might already be solved, can you please confirm? Thanks.

@aweiker
Copy link
Member

aweiker commented Mar 17, 2016

@seanabrahams Let's chat about this. Allowing external code access to the opts seems scary. The way that root_value works it is possible to have a callback function to load the data. This function should work with the authentication/authorization stack to populate information into root_value.

@seanabrahams
Copy link
Member Author

@joshprice, @aweiker clued me in on how this should be done properly 👍 . I've updated the wiki page I created (https://github.com/graphql-elixir/graphql-elixir/wiki/How-to-do-authentication-and-authorization-in-a-Phoenix-application-with-GraphQL) and am closing this PR.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants