Back to Node Auth0

Class UserInfoClient

docs/classes/userinfo.UserInfoClient.html

5.9.12.7 KB
Original Source

Class UserInfoClient

Auth0 UserInfo API Client

Provides access to the UserInfo endpoint to retrieve user profile information using an access token obtained during authentication.

Example: Basic usage

import { UserInfoClient } from 'auth0';const userInfoClient = new UserInfoClient({ domain: 'your-tenant.auth0.com'});const userInfo = await userInfoClient.getUserInfo(accessToken);console.log(userInfo.data.sub, userInfo.data.email);Copy

Index

Constructors

constructor

Methods

requestgetUserInfo

Properties

configuration

Constructors

constructor

new UserInfoClient(options: { domain: string } & ClientOptions): UserInfoClient

Create a new UserInfo API client

Parameters

Configuration options including domain and client settings

Returns UserInfoClient

Methods

Protectedrequest

request(
context: RequestOpts,
initOverrides?: RequestInit | InitOverrideFunction,
): Promise<Response>

Parameters

Returns Promise<Response>

getUserInfo

getUserInfo(
accessToken: string,
initOverrides?: InitOverride,
): Promise<JSONApiResponse<UserInfoResponse>>

Given an access token get the user profile linked to it.

Parameters

Returns Promise<JSONApiResponse<UserInfoResponse>>

Example

<caption> Get the user information based on the Auth0 access token (obtained during login). Find more information in the <a href="https://auth0.com/docs/auth-api#!#get--userinfo">API Docs</a>.</caption>const userInfoClient = new UserInfoClient({ domain: '...'});const userInfo = await userInfoClient.getUserInfo(accessToken);Copy

Properties

Protectedconfiguration

configuration: Configuration

Settings

Member Visibility

  • Protected
  • Inherited

ThemeOSLightDark

On This Page

Constructors constructor Methods requestgetUserInfo Properties configuration