Clerk logo

Clerk Docs

Ctrl + K
Go to clerkstage.dev

ExternalAccount

The ExternalAccount object describes a User's external account.

Overview

The ExternalAccount object is a model around an identification obtained by an external provider (e.g. an OAuth provider such as Google).

External account must be verified, so that we can make sure they can be assigned to their rightful owners. The ExternalAccount object holds all necessary state around the verification process.

Attributes

NameTypeDescription
idstring

A unique identifier for this external account.

identificationId string

The identification with which this external account is associated.

providerstring

The provider name e.g. oauth_google

providerUserIdstring

The unique id of the user in the provider.

emailAddressstring

The provided email address of the user.

approvedScopesstring[]

The scopes that the user has granted access to.

firstNamestring

The provided first name of the user.

lastName string

The provided last name of the user.

avatarUrlstring

The provided avatar URL of the user.

usernamestring | null

The provided username of the user.

labelstring | null

A descriptive label to differentiate multiple external accounts of the same user for the same provider.

verificationVerificationResource

An object holding information on the verification of this external account.

Methods

reauthorize(params)

reauthorize(params: ReauthorizeExternalAccountParams) => Promise<ExternalAccountResource>

Invoke a re-authorization flow for an existing external account.

Parameters

NameTypeDescription
additionalScopesstring[]

Any additional scopes you would like your user to be prompted to approve.

redirectUrlstring

The URL to redirect back to one the OAuth flow has completed successfully or unsuccessfully.

Returns

TypeDescription
Promise<void>

This method returns a Promise which doesn't resolve to any value.

destroy()

destroy() => Promise<void>

Delete this external account.

Parameters

This method accepts no parameters.

Returns

TypeDescription
Promise<void>

This method returns a Promise which doesn't resolve to any value.

Interfaces

VerificationResource

NameTypeDescription
statusstring | null

The verification status. Possible values are:

  • unverified: The verification process has not been completed.
  • verified: The verification process has completed successfully.
  • failed: The verification process has been completed, but failed.
  • expired: The verification is invalid because it wasn't completed in the allowed time.
strategystring | null

The verification strategy. For example oauth_google.

attemptsnumber | null

The number of attempts to complete the verification so far. Usually, a verification allows for maximum 3 attempts to be completed.

expireAtDate | null

The timestamp when the verification will expire and cease to be valid.

errorClerkAPIError | null

Any error that occurred during the verification process from the Clerk API.

externalVerificationRedirectURLURL | null

If this is a verification that is based on an external account (usually oauth_*), this is the URL that the user will be redirected to after the verification is completed.

Was this helpful?

Clerk © 2023