Dynamic client registration
Register a new OAuth client dynamically (RFC 7591)
POST
/
oauth
/
register
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx();
const response = await client.oauth.register();
console.log(response.client_id);from telnyx import Telnyx
client = Telnyx()
response = client.oauth.register()
print(response.client_id)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.OAuth.Register(context.TODO(), telnyx.OAuthRegisterParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.ClientID)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.oauth.OAuthRegisterParams;
import com.telnyx.sdk.models.oauth.OAuthRegisterResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
OAuthRegisterResponse response = client.oauth().register();
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.oauth.register
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->oauth->register(
clientName: 'My OAuth Application',
grantTypes: ['authorization_code'],
logoUri: 'https://example.com',
policyUri: 'https://example.com',
redirectUris: ['https://example.com/callback'],
responseTypes: ['string'],
scope: 'admin',
tokenEndpointAuthMethod: 'none',
tosUri: 'https://example.com',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx oauth register \
--api-key 'My API Key'curl --request POST \
--url https://api.telnyx.com/v2/oauth/register \
--header 'Content-Type: application/json' \
--data '
{
"redirect_uris": [
"https://example.com/callback"
],
"client_name": "My OAuth Application",
"grant_types": [
"authorization_code"
],
"response_types": [
"code"
],
"scope": "admin",
"token_endpoint_auth_method": "client_secret_basic",
"logo_uri": "<string>",
"tos_uri": "<string>",
"policy_uri": "<string>"
}
'{
"client_id": "abc123def456",
"client_id_issued_at": 123,
"client_secret": "<string>",
"redirect_uris": [
"<string>"
],
"client_name": "<string>",
"grant_types": [
"<string>"
],
"response_types": [
"<string>"
],
"scope": "<string>",
"token_endpoint_auth_method": "<string>",
"logo_uri": "<string>",
"tos_uri": "<string>",
"policy_uri": "<string>"
}{
"error": "invalid_client_metadata",
"error_description": "The client metadata was invalid",
"invalid_fields": {}
}Body
application/json
Response
Client registered successfully
Was this page helpful?
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx();
const response = await client.oauth.register();
console.log(response.client_id);from telnyx import Telnyx
client = Telnyx()
response = client.oauth.register()
print(response.client_id)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.OAuth.Register(context.TODO(), telnyx.OAuthRegisterParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.ClientID)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.oauth.OAuthRegisterParams;
import com.telnyx.sdk.models.oauth.OAuthRegisterResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
OAuthRegisterResponse response = client.oauth().register();
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.oauth.register
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->oauth->register(
clientName: 'My OAuth Application',
grantTypes: ['authorization_code'],
logoUri: 'https://example.com',
policyUri: 'https://example.com',
redirectUris: ['https://example.com/callback'],
responseTypes: ['string'],
scope: 'admin',
tokenEndpointAuthMethod: 'none',
tosUri: 'https://example.com',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx oauth register \
--api-key 'My API Key'curl --request POST \
--url https://api.telnyx.com/v2/oauth/register \
--header 'Content-Type: application/json' \
--data '
{
"redirect_uris": [
"https://example.com/callback"
],
"client_name": "My OAuth Application",
"grant_types": [
"authorization_code"
],
"response_types": [
"code"
],
"scope": "admin",
"token_endpoint_auth_method": "client_secret_basic",
"logo_uri": "<string>",
"tos_uri": "<string>",
"policy_uri": "<string>"
}
'{
"client_id": "abc123def456",
"client_id_issued_at": 123,
"client_secret": "<string>",
"redirect_uris": [
"<string>"
],
"client_name": "<string>",
"grant_types": [
"<string>"
],
"response_types": [
"<string>"
],
"scope": "<string>",
"token_endpoint_auth_method": "<string>",
"logo_uri": "<string>",
"tos_uri": "<string>",
"policy_uri": "<string>"
}{
"error": "invalid_client_metadata",
"error_description": "The client metadata was invalid",
"invalid_fields": {}
}