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

async function main() {
    const client = new ManagementClient({
        token: "<token>",
    });
    await client.users.authenticationMethods.set("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 in question.

Body

type
enum<string>
required
Available options:
phone,
email,
totp
preferred_authentication_method
enum<string>

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

Available options:
voice,
sms
name
string

AA human-readable label to identify the authentication method.

Required string length: 1 - 20
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.

Minimum string length: 1
totp_secret
string

Applies to totp authentication methods only. The base32 encoded secret for TOTP generation.

Minimum string length: 1

Response

All authentication methods successfully updated.

type
enum<string>
required
Available options:
phone,
email,
totp,
webauthn-roaming
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