User Profile
The support for custom attributes is under development. You can keep track of the issue here: https://github.com/authgear/authgear-server/issues/1510
The user profiles contain information about your end-users such as name, email, addresses, and unique identifier. You can manage the profiles via the Portal & Admin API. The end-users can also manage their own profile through the Profile section in the User Setting page provided by the AuthUI.

UserInfo Endpoint

The UserInfo endpoint returns the Claims about the authenticated end-user, including the standard profile and custom attributes.
In the meantime, the userInfo object is returned from calling fetch user info function which contains a unique identifier of the 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
JavaScript
iOS
Android
1
try{
2
const userInfo = await authgear.fetchUserInfo()
3
} catch(e) {
4
// failed to fetch user info
5
// the refresh token maybe expired or revoked
6
}
Copied!
1
authgear.fetchUserInfo { userInfoResult in
2
// sessionState is now up to date
3
// it will change to .noSession if the session is invalid
4
let sessionState = authgear.sessionState
5
6
switch userInfoResult {
7
case let .success(userInfo):
8
// read the userInfo if needed
9
case let .failure(error):
10
// failed to fetch user info
11
// the refresh token maybe expired or revoked
12
}
Copied!
1
authgear.fetchUserInfo(new OnFetchUserInfoListener() {
2
@Override
3
public void onFetchedUserInfo(@NonNull UserInfo userInfo) {
4
// sessionState is now up to date
5
// read the userInfo if needed
6
}
7
8
@Override
9
public void onFetchingUserInfoFailed(@NonNull Throwable throwable) {
10
// sessionState is now up to date
11
// it will change to NO_SESSION if the session is invalid
12
}
13
});
Copied!

Standard Attributes

The following attributes are built-in supported by Authgear. They are the set of Standard Claims defined by the OIDC specifications. Some of them are default hidden from the Admin Portal and end-users. Their visibility and mutability can be configured through the Admin Portal.
Attribute name
Default Visibility
Format
Name
Hidden
String
Given Name
Editable
String
Family Name
Editable
String
Middle Name
Hidden
String
Nickname
Hidden
String
Profile
Hidden
URL String
Picture
Editable
URL String
Website
Hidden
URL String
Gender
Editable
male, female or Custom String
Birthdate
Editable
Date in YYYY-MM-DD
Timezone
Editable
Language
Editable
BCP47 language tag enabled by the project
Address
Hidden
JSON Object

Standard Attributes that are coupled with Identities

The following attributes are coupled with the identities owned by the end-user. The represents the email addresses, phone numbers, or usernames the end-users are using to authenticate themselves on Authgear. If the end-user uses a third-party identity provider for authentication, these attributes will be coupled with the corresponding attributes returned by the provider.
  • email
  • email_verified
  • phone_number
  • phone_number_verified
  • preferred_username

User Profile Configuration

The access rights for different parties on individual attributes can be configured through the Authgear Portal. Under the hood, all the attributes are available, however, they can be configured to be hidden or read-only according to the needs of your projects to avoid confusion.
These are the parties that have access to the user profile:

The Admin API

Through the Admin API, developers ALWAYS have full access to ALL the standard attributes and custom attributes. The Admin API allows the developer to view or edit the standard attributes and the custom attributes.

The Portal

The admin user can view or edit the standard attributes via the Authgear Portal.

The Session Bearer

The session bearer is someone who has a valid session cookie or a valid access token. The standard attributes of the end-user whom the session represents can be viewed by accessing the UserInfo endpoint and the resolver endpoint. The session bearer can be the end-user, the client mobile app, or the client website.

The End-user

The end-user can view or edit the standard attributes through the Profile section in the User Setting page provided by the AuthUI.

Profiles from Third-party Identity Providers

Authgear supports various social and enterprise identity providers. End-users can sign up and log in to your apps via these connections. Upon signup, these providers will return a set of user attributes about the end-user. Authgear will copy those attributes and populate the profile of the end-user.
More info about the population logic can be found in the specification.
Last modified 1mo ago