Passer au contenu principal
PATCH
https://{tenantDomain}/api/v2
/
users
/
{id}
/
authentication-methods
/
{authentication_method_id}
Go
package example

import (
    context "context"

    client "github.com/auth0/go-auth0/management/management/client"
    option "github.com/auth0/go-auth0/management/management/option"
    users "github.com/auth0/go-auth0/management/management/users"
)

func do() {
    client := client.NewClient(
        option.WithToken(
            "<token>",
        ),
    )
    request := &users.UpdateUserAuthenticationMethodRequestContent{}
    client.Users.AuthenticationMethods.Update(
        context.TODO(),
        "id",
        "authentication_method_id",
        request,
    )
}
import { ManagementClient } from "auth0";

async function main() {
    const client = new ManagementClient({
        token: "<token>",
    });
    await client.users.authenticationMethods.update("id", "authentication_method_id", {});
}
main();
import { ManagementClient } from "auth0";

async function main() {
    const client = new ManagementClient({
        token: "<token>",
    });
    await client.users.authenticationMethods.update("id", "authentication_method_id", {});
}
main();
curl --request PATCH \
  --url https://{tenantDomain}/api/v2/users/{id}/authentication-methods/{authentication_method_id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>"
}
'
import requests

url = "https://{tenantDomain}/api/v2/users/{id}/authentication-methods/{authentication_method_id}"

payload = { "name": "<string>" }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://{tenantDomain}/api/v2/users/{id}/authentication-methods/{authentication_method_id}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PATCH",
  CURLOPT_POSTFIELDS => json_encode([
    'name' => '<string>'
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
HttpResponse<String> response = Unirest.patch("https://{tenantDomain}/api/v2/users/{id}/authentication-methods/{authentication_method_id}")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"<string>\"\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://{tenantDomain}/api/v2/users/{id}/authentication-methods/{authentication_method_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "<string>",
  "name": "<string>",
  "totp_secret": "<string>",
  "phone_number": "<string>",
  "email": "<string>",
  "authentication_methods": [
    {
      "id": "<string>"
    }
  ],
  "key_id": "<string>",
  "public_key": "<string>",
  "aaguid": "<string>",
  "relying_party_identifier": "<string>",
  "confirmed": true,
  "created_at": "2023-11-07T05:31:56Z"
}

Autorisations

Authorization
string
header
requis

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

Paramètres de chemin

id
string
requis

The ID of the user in question.

authentication_method_id
string
requis

The ID of the authentication method to update.

Corps

name
string

A human-readable label to identify the authentication method.

preferred_authentication_method
enum<string>

Preferred phone authentication method

Options disponibles:
voice,
sms

Réponse

Authentication method updated.

The successfully created authentication method.

type
enum<string>
requis
Options disponibles:
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>

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

Options disponibles:
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.

aaguid
string

Applies to passkey authentication methods only. Authenticator Attestation Globally Unique Identifier.

relying_party_identifier
string

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

confirmed
boolean

Whether the authentication method has been confirmed.

created_at
string<date-time>

Authentication method creation date