# Ensure you're logged in: auth0 login
auth0 api put "users/id/authentication-methods" --data '[
{
"type": "phone"
}
]'
using Auth0.ManagementApi;
using System.Threading.Tasks;
using System.Collections.Generic;
public partial class Examples
{
public async Task Example() {
var client = new ManagementApiClient(
token: "<token>",
clientOptions: new ClientOptions { BaseUrl = "https://{YOUR_DOMAIN}/api/v2" }
);
await client.Users.AuthenticationMethods.SetAsync(
id: "id",
request: new List<SetUserAuthenticationMethods>(){
new SetUserAuthenticationMethods {
Type = AuthenticationTypeEnum.Phone
},
}
);
}
}
package com.example.usage;
import com.auth0.client.mgmt.ManagementApi;
import com.auth0.client.mgmt.types.AuthenticationTypeEnum;
import com.auth0.client.mgmt.types.SetUserAuthenticationMethods;
import java.util.Arrays;
public class Example {
public static void main(String[] args) {
ManagementApi client = ManagementApi
.builder()
.domain("{YOUR_DOMAIN}")
.token("<token>")
.build();
client.users().authenticationMethods().set(
"id",
Arrays.asList(
SetUserAuthenticationMethods
.builder()
.type(AuthenticationTypeEnum.PHONE)
.build()
)
);
}
}
<?php
namespace Example;
use Auth0\SDK\API\Management\Wrapper\ManagementClient;
use Auth0\SDK\API\Management\Wrapper\ManagementClientOptions;
use Auth0\SDK\API\Management\Types\SetUserAuthenticationMethods;
use Auth0\SDK\API\Management\Types\AuthenticationTypeEnum;
$client = new ManagementClient(new ManagementClientOptions(
domain: '{YOUR_DOMAIN}',
token: '<token>',
));
$client->users->authenticationMethods->set(
'id',
[
new SetUserAuthenticationMethods([
'type' => AuthenticationTypeEnum::Phone->value,
]),
],
);
# Ensure you're logged in: auth0 login
auth0 api put "users/id/authentication-methods" --data '[
{
"type": "phone"
}
]'
using Auth0.ManagementApi;
using System.Threading.Tasks;
using System.Collections.Generic;
public partial class Examples
{
public async Task Example() {
var client = new ManagementApiClient(
token: "<token>",
clientOptions: new ClientOptions { BaseUrl = "https://{YOUR_DOMAIN}/api/v2" }
);
await client.Users.AuthenticationMethods.SetAsync(
id: "id",
request: new List<SetUserAuthenticationMethods>(){
new SetUserAuthenticationMethods {
Type = AuthenticationTypeEnum.Phone
},
}
);
}
}
package com.example.usage;
import com.auth0.client.mgmt.ManagementApi;
import com.auth0.client.mgmt.types.AuthenticationTypeEnum;
import com.auth0.client.mgmt.types.SetUserAuthenticationMethods;
import java.util.Arrays;
public class Example {
public static void main(String[] args) {
ManagementApi client = ManagementApi
.builder()
.domain("{YOUR_DOMAIN}")
.token("<token>")
.build();
client.users().authenticationMethods().set(
"id",
Arrays.asList(
SetUserAuthenticationMethods
.builder()
.type(AuthenticationTypeEnum.PHONE)
.build()
)
);
}
}
<?php
namespace Example;
use Auth0\SDK\API\Management\Wrapper\ManagementClient;
use Auth0\SDK\API\Management\Wrapper\ManagementClientOptions;
use Auth0\SDK\API\Management\Types\SetUserAuthenticationMethods;
use Auth0\SDK\API\Management\Types\AuthenticationTypeEnum;
$client = new ManagementClient(new ManagementClientOptions(
domain: '{YOUR_DOMAIN}',
token: '<token>',
));
$client->users->authenticationMethods->set(
'id',
[
new SetUserAuthenticationMethods([
'type' => AuthenticationTypeEnum::Phone->value,
]),
],
);