Linking data to auth usersΒΆ
The Auth microservice assigns a unique integer identifier called hasura_id
to every user registered on it.
It is a common requirement to link data in a table with users maintained by the Auth microservice.
This can be achieved by adding a new column called user_id
(or any other name of your choice) of type integer
to the table and storing the hasura_id
of the user in it while adding a row.
For a logged in user, the hasura_id
can be obtained like this
Note
The user_id
field can now be used to define ownership of the rows in the table. ie: limit users to fetch/edit their own data only. See data permissions for more details.
Was this page helpful?