Back to Node Auth0

Class IdentitiesClient

docs/classes/management.SDK.IdentitiesClient.html

5.9.16.0 KB
Original Source

Class IdentitiesClient

Index

Constructors

constructor

Methods

linkdelete

Properties

_options

Constructors

constructor

new IdentitiesClient(options: BaseClientOptions): IdentitiesClient

Parameters

Returns IdentitiesClient

Methods

link(
id: string,
request?: LinkUserIdentityRequestContent,
requestOptions?: IdentitiesClient.RequestOptions,
): HttpResponsePromise<UserIdentity[]>

Link two user accounts together forming a primary and secondary relationship. On successful linking, the endpoint returns the new array of the primary account identities.

Note: There are two ways of invoking the endpoint:

  • With the authenticated primary account's JWT in the Authorization header, which has the update:current_user_identities scope:
POST /api/v2/users/PRIMARY_ACCOUNT_USER_ID/identities
      Authorization: "Bearer PRIMARY_ACCOUNT_JWT"
      {
        "link_with": "SECONDARY_ACCOUNT_JWT"
      }

In this case, only the link_with param is required in the body, which also contains the JWT obtained upon the secondary account's authentication.

  • With a token generated by the API V2 containing the update:users scope:
POST /api/v2/users/PRIMARY_ACCOUNT_USER_ID/identities
    Authorization: "Bearer YOUR_API_V2_TOKEN"
    {
      "provider": "SECONDARY_ACCOUNT_PROVIDER",
      "connection_id": "SECONDARY_ACCOUNT_CONNECTION_ID(OPTIONAL)",
      "user_id": "SECONDARY_ACCOUNT_USER_ID"
    }

In this case you need to send provider and user_id in the body. Optionally you can also send the connection_id param which is suitable for identifying a particular database connection for the 'auth0' provider.

Parameters

  • id: string

ID of the primary user account to link a second user account to.

Request-specific configuration.

Returns HttpResponsePromise<UserIdentity[]>

Throws

Management.BadRequestError

Throws

Management.UnauthorizedError

Throws

Management.ForbiddenError

Throws

Management.ConflictError

Throws

Management.TooManyRequestsError

Example

await client.users.identities.link("id")Copy

delete

delete(
id: string,
provider: Management.UserIdentityProviderEnum,
user_id: string,
requestOptions?: IdentitiesClient.RequestOptions,
): HttpResponsePromise<DeleteUserIdentityResponseContent>

Unlink a specific secondary account from a target user. This action requires the ID of both the target user and the secondary account.

Unlinking the secondary account removes it from the identities array of the target user and creates a new standalone profile for the secondary account. To learn more, review Unlink User Accounts.

Parameters

  • id: string

ID of the primary user account.

Identity provider name of the secondary linked account (e.g. google-oauth2).

  • user_id: string

ID of the secondary linked account (e.g. 123456789081523216417 part after the | in google-oauth2|123456789081523216417).

Request-specific configuration.

Returns HttpResponsePromise<DeleteUserIdentityResponseContent>

Throws

Management.BadRequestError

Throws

Management.UnauthorizedError

Throws

Management.ForbiddenError

Throws

Management.TooManyRequestsError

Example

await client.users.identities.delete("id", "ad", "user_id")Copy

Properties

Protected Readonly_options

_options: NormalizedClientOptionsWithAuth<BaseClientOptions>

Settings

Member Visibility

  • Protected
  • Inherited

ThemeOSLightDark

On This Page

Constructors constructor Methods linkdelete Properties _options