Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AuthGuardian support for adding Hasura session variables directly #42

Open
sgrove opened this issue Jan 21, 2020 · 0 comments
Open

AuthGuardian support for adding Hasura session variables directly #42

sgrove opened this issue Jan 21, 2020 · 0 comments

Comments

@sgrove
Copy link

sgrove commented Jan 21, 2020

A quick update, we've added an effect in AuthGuardian to add session variables
directly. Simple choose the action On Hasura set session variable, give the
variable a name, and we'll take care of prefixing the name and putting it in the right JWT location.

See the Hasura documentation on how session variables can be used with
permissions, mutations, and so much
more
.
It's an incredibly powerful system for being so small!

For example, if we want to make the user's verified TwitchTV email available for
our Hasura permission, queries, or mutations, we can set the following
AuthGuardian rules:

When this user on Twitch has verified email is true

Then On hasura set session variable email built in value TWITCH_TV_EMAIL

And our resulting JWT will have the X-HASURA-EMAIL variable correctly set:

{
  "iss": "OneGraph",
  "aud": "https://serve.onegraph.com/dashboard/app/00000000-0000-0000-0000-000000000000",
  "iat": 1579589498,
  "exp": 1579675898,
  "https://hasura.io/jwt/claims": {
    "x-hasura-email": "[email protected]"
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant