Skip to main content
POST
/
users
/
{id}
/
authentication-methods
TypeScript
import { ManagementClient } from "auth0";

async function main() {
    const client = new ManagementClient({
        token: "<token>",
    });
    await client.users.authenticationMethods.create("id", {
        type: "phone",
    });
}
main();
{
  "type": "phone",
  "id": "<string>",
  "name": "<string>",
  "totp_secret": "<string>",
  "phone_number": "<string>",
  "email": "<string>",
  "authentication_methods": [
    {
      "type": "totp",
      "id": "<string>"
    }
  ],
  "preferred_authentication_method": "voice",
  "key_id": "<string>",
  "public_key": "<string>",
  "aaguid": "<string>",
  "relying_party_identifier": "<string>",
  "created_at": "2023-11-07T05:31:56Z"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id
string
required

The ID of the user to whom the new authentication method will be assigned.

Body

type
enum<string>
required
Available options:
phone,
email,
totp,
webauthn-roaming,
passkey
name
string

A human-readable label to identify the authentication method.

totp_secret
string

Base32 encoded secret for TOTP generation.

phone_number
string

Applies to phone authentication methods only. The destination phone number used to send verification codes via text and voice.

Required string length: 2 - 30
email
string

Applies to email authentication methods only. The email address used to send verification messages.

preferred_authentication_method
enum<string>

Applies to phone authentication methods only. The preferred communication method.

Available options:
voice,
sms
key_id
string

Applies to webauthn authentication methods only. The id of the credential.

public_key
string

Applies to webauthn authentication methods only. The public key, which is encoded as base64.

relying_party_identifier
string<hostname>

Applies to webauthn authentication methods only. The relying party identifier.

Response

Authentication method created.

The successfully created authentication method.

type
enum<string>
required
Available options:
phone,
email,
totp,
webauthn-roaming,
passkey
id
string<authenticator-id>

The ID of the newly created authentication method (automatically generated by the application)

name
string

A human-readable label to identify the authentication method.

totp_secret
string

Base32 encoded secret for TOTP generation

phone_number
string

Applies to phone authentication methods only. The destination phone number used to send verification codes via text and voice.

Required string length: 2 - 30
email
string

Applies to email authentication methods only. The email address used to send verification messages.

authentication_methods
object[]
preferred_authentication_method
enum<string>

Preferred phone authentication method

Available options:
voice,
sms
key_id
string

Applies to webauthn authenticators only. The id of the credential.

public_key
string

Applies to webauthn authenticators only. The public key.

aaguid
string

Applies to passkeys only. Authenticator Attestation Globally Unique Identifier.

relying_party_identifier
string

Applies to webauthn authenticators only. The relying party identifier.

created_at
string<date-time>

Authentication method creation date