Access User Profiles
Learn how to access User Profiles
Last updated
Learn how to access User Profiles
Last updated
To access any of the applications in your Authgear account, each user must have a profile in the account. User Profiles contain information about your users such as name, contact information, and standard and custom attributes you define. You can retrieve and manage user profiles in the following ways:
The standard attributes in UserProfile in OIDC are a standardized schema for representing the end-users identity information and you can not add or delete them. To introduce additional attributes, use custom attributes.
Access Right defines what information can be viewed or modified when a user's profile is accessed via the Authgear Portal, User Info endpoint, or User Settings page.
An Access Right can be set for each profile attribute under a specific medium of accessing user profiles. For example, in the following screenshot, the Primary Email attribute has the Editable Access Right for Portal, Read-only
for User Info endpoint (also known as access Token Bearer), and Editable
for User Settings page. In simpler terms, the example means an admin can modify Primary Email in Authgear Portal, while a client application can use a user's access token to view their Primary Email. Finally, users can edit their own Primary Email from the User Settings page.
The following are the available Access Right options that can be applied to each attribute for a specific medium.
Editable: Grants a medium access to view and modify the value of an attribute.
Read-only: A medium with this access for an attribute can only view the value of the attribute.
Hidden: If the access for an attribute is set to Hidden
for a medium, that medium can not view or modify the attribute.
By default, Authgear sets different access rights for the standard attributes on each way of accessing user profiles. You can view and configure this default access right from User Profile > Standard Attributes in the Authgear Portal.
For Custom Attributes, you can define the access right for each way of accessing a user profile from User Profile > Custom Attributes in the portal.
Each way of accessing user profiles belongs to one of the following Access Right Categories:
Portal Admin Access Right: Use this category to set the access right of an attribute in the Authgear Portal for an admin user.
Token Bearer Access Right: This sets the access right of an attribute for the User Info endpoint when a token bearer accesses it. It can be "Hidden" or "Read-Only".
End-user Access Right: Use this to set the access right of the attribute for the default User Settings UI when accessed by an end-user.
An Authgear account: You need an Authgear account to follow this guide. If you don't have one, you can create it for free on the Authgear website.
A Registered App: You need a registered application (client) in Authgear.
It is the fastest and easiest way to view user profiles and manage them.
Once Authgear completes authentication and returns control to your application, it provides the user profile to the application. Most developers prefer to use the Authgear SDKs to get the UserInfo object using the fetch user info function. To start using this function read getting started guides relevant to the SDK of your choice. Here are some code snippets that call the fetch user info function for different Authgear SDKs:
See the UserInfo page for more details about the shape of user info and the available user profile attributes.
Authgear provides an Admin API GraphQL endpoint that allows applications and services to access and manipulate the User Profile object. The API Explorer lets users interactively explore the Admin API. With the API Explorer, you can search for users' profiles or update their standard or custom attributes. See the example steps of how to achieve this below:
The OpenID Connect (OIDC) UseInfo endpoint is a protected resource that provides information about a user when a service provider presents an access token that has been issued by your Authgear Token endpoint. The scopes in the access token specify the user attributes that are returned in the response of the user info endpoint. It is important to note that the openid
scope must be one of the access token claims.
The UserInfo endpoint returns the Claims about the authenticated end-user, including the standard profile and custom attributes.
The userInfo
object is returned from calling fetch user info function which contains a unique identifier of the user.
The following are some attributes that are usually in the userInfo object. Other attributes like email, phoneNumber and custom attributes will be in the userInfo object if those attributes were set for the current user.
Key | Type | Description |
---|---|---|
isAnonymous | boolean | Indicate if the user is anonymous, i.e. no identity or authenticator is provided |
isVerified | boolean | Indicate if the user completed the verification requirement |
sub | string | Unique identifier of the user in your Authgear project |
To access a user's profile using the UserInfo endpoint of OpenID Connect, you need to follow these steps:
See a detailed explanation of the structure and fields included in the response of the UserInfo endpoint here.
Authgear WebHooks makes it possible to embed the standard attributes and custom attributes for a user's profile into the OIDC JSON Web Token (JWT). Hence, you access both profile attributes in the JWT returned to your OIDC client without making another call to the UserInfo endpoint.
See our post about how to Add custom fields to a JWT Access Token to learn more.