Skip to Content
Clerk logo

Clerk Docs

Ctrl + K
Go to clerkstage.dev

Create user metadata

createEmailAddress()

function createEmailAddress: (params: CreateEmailAddressParams) => Promise<EmailAddress>;

Adds an email address for the user. A new EmailAddress will be created and associated with the user.

CreateEmailAddressParams

NameTypeDescription
emailstringThe value of the email address

Returns

TypeDescription
Promise<EmailAddress>The email address created for the user.

createPhoneNumber()

function createPhoneNumber: (params: CreatePhoneNumberParams) => Promise<PhoneNumber>;

Adds a phone number for the user. A new PhoneNumber will be created and associated with the user.

CreatePhoneNumberParams

NameTypeDescription
phoneNumberstringThe value of the phone number, in E.164(opens in a new tab) format.

Returns

TypeDescription
Promise<PhoneNumber>The phone number created for the user.

createWeb3Wallet()

function createWeb3Wallet: (params: CreateWeb3WalletParams) => Promise<Web3Wallet>;

Adds a web3 wallet for the user. A new Web3Wallet< will be created and associated with the user.

CreateWeb3WalletParams

NameTypeDescription
web3WalletstringIn Ethereum(opens in a new tab), the address is made up of 0x + 40 hexadecimal characters

Returns

TypeDescription
Promise<Web3Wallet>The web3 wallet created for the user.

createExternalAccount()

function createExternalAccount: (params: CreateExternalAccountParams) => Promise<ExternalAccount>;

Adds an external account for the user. A new ExternalAccount will be created and associated with the user.

CreateExternalAccountParams

NameTypeDescription
strategyOAuthStrategyThe strategy corresponding to the oauth provider, e.g. oauth_facebook, oauth_github, etc
redirectUrl?stringThe URL to redirect back to one the oauth flow has completed successfully or unsuccessfully.
additionalScopes?string[]Any additional scopes you would like your user to be prompted to approve.

Returns

TypeDescription
Promise<ExternalAccount>The external account created for the user.

The initial state of the returned ExternalAccount will be unverified. To initiate the connection with the external provider one should redirect to the externalAccount.verification.externalVerificationRedirectURL contained in the result of createExternalAccount.

Upon return, one can inspect within the user.externalAccounts the entry that corresponds to the requested strategy:

  • If the connection was successful then externalAccount.verification.status should be verified
  • If the connection was not successful, then the externalAccount.verification.status will not be verified and the externalAccount.verification.error will contain the error encountered so that you can present corresponding feedback to the user

What did you think of this content?

Clerk © 2024