Skip to Content
You are viewing a beta version of Clerk Docs
Visit the latest docs
Clerk logo

Clerk Docs

Ctrl + K
Go to clerk.com

ExternalAccount

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 you can make sure they can be assigned to their rightful owners. The ExternalAccount object holds all necessary state around the verification process.

Properties

NameTypeDescription
idstringA unique identifier for this external account.
identificationIdstringThe identification with which this external account is associated.
providerstringThe provider name e.g. google
providerUserIdstringThe unique ID of the user in the provider.
emailAddressstringThe provided email address of the user.
approvedScopesstring[]The scopes that the user has granted access to.
firstNamestringThe provided first name of the user.
lastNamestringThe provided last name of the user.
imageUrlstringThe provided image URL of the user.
usernamestring | nullThe provided username of the user.
publicMetadataobjectMetadata provided about the user from the provider.
labelstring | nullA descriptive label to differentiate multiple external accounts of the same user for the same provider.
verificationVerificationAn object holding information on the verification of this external account.

Methods

reauthorize()

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

function reauthorize(params: ReauthorizeExternalAccountParams): Promise<ExternalAccount>;

ReauthorizeExternalAccountParams

NameTypeDescription
additionalScopesstring[]Any additional scopes you would like your user to be prompted to approve.
redirectUrlstringThe URL to redirect back to one the OAuth flow has completed successfully or unsuccessfully.

reauthorize() returns

TypeDescription
Promise<ExternalAccount>A Promise which resolves with the ExternalAccount for the user.

destroy()

Deletes this external account.

function destroy(): Promise<void>;

providerSlug()

A getter method for the provider attribute.

function providerSlug(): string;

providerTitle()

Returns the title of the provider with the word "Account" appended.

EG: if google is passed as the parameter, Google Account will be returned.

function providerTitle(): string;

accountIdentifier()

Returns the identifier of the account, which can be one of the following:

  • username if present
  • emailAddress if present
  • label
function accountIdentifier(): string;

Last updated on October 5, 2023

What did you think of this content?

Clerk © 2024