Skip to content

how to get the user_id that in jwt to fill into a column? #9482

Answered by meetzaveri
lwsbox asked this question in Question
Discussion options

You must be logged in to vote

Hey @lwsbox

If I am guessing correct, you are using JWT authentication mode here. I this case, we believe that your auth server generates JWT which upon decoded, contains user_id in it.

For updating table row, you'll need to perform update mutation to that table. ̦ Preferred way would be to pass user_id as one of the session variables, say for eg. x-hasura-user-id.

We can utilize "column presets" functionality where column value gets updated from the session variable everytime when update mutation is performed against that specific table. You can set column preset for any column in permissions and select the preset type (either static value or session variable). More demonstration here - h…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by lwsbox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants