Skip to main content
GET
/
oauth
/
authorize
JavaScript
import Telnyx from 'telnyx';

const client = new Telnyx();

await client.oauth.retrieveAuthorize({
  client_id: 'client_id',
  redirect_uri: 'https://example.com',
  response_type: 'code',
});
from telnyx import Telnyx

client = Telnyx()
client.oauth.retrieve_authorize(
client_id="client_id",
redirect_uri="https://example.com",
response_type="code",
)
package main

import (
"context"

"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)

func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
err := client.OAuth.GetAuthorize(context.TODO(), telnyx.OAuthGetAuthorizeParams{
ClientID: "client_id",
RedirectUri: "https://example.com",
ResponseType: telnyx.OAuthGetAuthorizeParamsResponseTypeCode,
})
if err != nil {
panic(err.Error())
}
}
package com.telnyx.sdk.example;

import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.oauth.OAuthRetrieveAuthorizeParams;

public final class Main {
private Main() {}

public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();

OAuthRetrieveAuthorizeParams params = OAuthRetrieveAuthorizeParams.builder()
.clientId("client_id")
.redirectUri("https://example.com")
.responseType(OAuthRetrieveAuthorizeParams.ResponseType.CODE)
.build();
client.oauth().retrieveAuthorize(params);
}
}
require "telnyx"

telnyx = Telnyx::Client.new(api_key: "My API Key")

result = telnyx.oauth.retrieve_authorize(
client_id: "client_id",
redirect_uri: "https://example.com",
response_type: :code
)

puts(result)
<?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 {
$result = $client->oauth->retrieveAuthorize(
clientID: 'client_id',
redirectUri: 'https://example.com',
responseType: 'code',
codeChallenge: 'code_challenge',
codeChallengeMethod: 'plain',
scope: 'scope',
state: 'state',
);

var_dump($result);
} catch (APIException $e) {
echo $e->getMessage();
}
telnyx oauth retrieve-authorize \
--api-key 'My API Key' \
--client-id client_id \
--redirect-uri https://example.com \
--response-type code
curl --request GET \
--url https://api.telnyx.com/v2/oauth/authorize
"<string>"
"<string>"
"<string>"

Query Parameters

response_type
enum<string>
required

OAuth response type

Available options:
code
client_id
string
required

OAuth client identifier

redirect_uri
string<uri>
required

Redirect URI

scope
string

Space-separated list of requested scopes

state
string

State parameter for CSRF protection

code_challenge
string

PKCE code challenge

code_challenge_method
enum<string>

PKCE code challenge method

Available options:
plain,
S256

Response

Consent page displayed (when consent UI is embedded)