Skip to main content

Get user information

This page instructs you how to get information about the user that is currently logged in. There are two main ways to do so.


📋Prerequisites
  • The user must be logged into your application via Passport

Getting user information via API

There is a getUserInfo API that can be used with the users access token. It will return the following:

PropertyDescription
subThe subject (unique identifier) of the logged-in user.
email1The email address of the logged-in user. This property will be undefined if the email scope has not been requested.
passportAddressThe Passport address of the logged-in user (if they've been registered).
linkedAddressesThe external wallets the user has linked to their Passport account via the Dashboard.

Getting user information via Typescript SDK

The getUserInfo function on the Passport instance returns a promise that resolves with the following information about the currently logged-in user:

const userProfile = await passportInstance.getUserInfo();
PropertyDescription
email1The email address of the logged-in user. This property will be undefined if the email scope has not been requested.
subThe subject (unique identifier) of the logged-in user.
nicknameThe nickname of the logged-in user.

Note that the getUserInfo function may throw the following error:

Error CodeCauseResolution
NOT_LOGGED_IN_ERRORNo user is logged in at the time of the function call.Verify that a user has logged in before attempting to call getUserInfo

The user's linked addresses can also be retrieved from the Typescript SDK like so:

const linkedAddresses = await passportInstance.getLinkedAddresses();

1 Apple Social Login Email Masking Restrictions: Partners implementing the Apple Social Login within Passport should note a potential restriction regarding the user's email address. If a user chooses to mask their email address, the email address return will appear as xyz@privaterelay.appleid.com. A masked email prevents partners from directly emailing users. Partners must consider this limitation while interacting with users who have enabled email masking through Apple Social Login. For any further inquiries or assistance, please get in touch with our dedicated support team.