docs
  • Hasura Platform
    • Getting started
    • Installing the Hasura CLI
    • The complete tutorial
    • GraphQL tutorial
    • Hasura project
    • Hasura cluster
    • Project microservices
    • API Console
    • Auth
    • Data (GraphQL/JSON APIs)
      • GraphQL
      • Creating a table
      • Altering a table
      • Inserting data
      • Retrieving data
      • Updating data
      • Deleting data
      • Bulk queries
      • Running SQL commands
      • Permissions and access control
      • Data relationships
      • Linking data to auth users
      • Data/schema migrations
      • Views
      • Aggregations
      • Data Modelling Guide
    • Filestore
    • Notify (Sending emails/SMS)
    • Postgres
    • API gateway
    • Hasura Hub
    • Hasura CLI reference
    • Hasura API reference
    • Guides
    • Installing Hasura on a Kubernetes Cluster
    • Hasura architecture
    • Billing for Hasura
    • Moving to v0.16 from v0.15
    • Moving to v0.15 from older versions
DOCS  vx.y

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.

« previous | next »
Was this page helpful?

Thank you for your feedback!
Want to contribute or report missing content? Check out the github repo for docs.
Powered by Sphinx. Copyright © 2019 Hasura.

<%= totalResults %> result<%= totalResults > 1 ? 's' : '' %> for '<%= _.escape(searchString) %>'
powered by Algolia Hasura Search

<% if ( objs.length > 0 ) { %>
    <% _.each(objs, function(obj, index ) { %>
  • <%= obj.title %>
    <%= obj.description.length > 200 ? obj.description.slice(0, 200 ) + ' ...' : obj.description %>
  • <% }); %>
<% } else { %>
Sorry! we cannot find what you are searching for!
<% } %>