graphql-engine
graphql-engine copied to clipboard
Actions should be able to update session variables
Problem We have a following popular scenario:
- Use Actions to make a JWT auth flow and assign it to
authmutation - Actions return JWT info + user_id
- Create relationship user_id -> user
But if user table has any permissions nothing will be returned from the user type in the auth mutation because the context of this query does not have a session variable
Possible solution Allow updating session variables in the response which replaces context for relationships down the tree
I guess the way you might be working around this currently is by doing the auth mutation and then doing query for user separately (with the jwt token/session variables set)?
Yep, that's what we're doing right now May be we could have a convention that auth handler might have some "X-Hasura-Context-*" headers that right-merge the original ones with anything in the wildcard
We've encountered this problem on 2 other projects. Practically what we're trying to solve here is to remove extra query. Using bespoke graphql server allows returning the user alongside the authentication response with access\refresh tokens
@tirumaraiselvan any update on this? Maybe something similar is being tracked elsewhere?