Insites Docs Developers guide Data and UsersUsersAccessing Authenticated User Data

Accessing Authenticated User Data

Last updated on June 26, 2024.

This document guides you in accessing the information of authenticated users.

Prerequisites

To follow the steps in this tutorial, you must understand the required directory structure for your codebase and understand the concepts of pages, users, and GraphQL. In addition you must follow the previous tutorials in the Users section to have information regarding authenticated users stored and ready for access.

Steps

Accessing authenticated user data is a two-step process:

  • Step 1: Create a GraphQL query
  • Step 2: Fetch information from the GraphQL file

Step 1: Create a GraphQL query

app/graphql/current_user.graphql

Step 2: Fetch information from the GraphQL file

On any given page (including the layout itself), you can add this liquid tag:

Be careful with adding queries to the layout.

This tag fetches information defined in the GraphQL file for the currently logged-in user and stores it in a variable named . The returned data is a standard hash so you can display it via .

Next steps

Congratulations! You know how to access the information of authenticated users. Now you can learn about sending an Email Notification to a newly signed-up user: Creating an Email Notification

Have a suggestion for this page?

Didn't quite find what you are looking for or have feedback on how we can make the content better then we would love to hear from you. Please provide us feedback and we will get back to you shortly.