Get OAuth consent token
Retrieve details about an OAuth consent token
GET
/
oauth
/
consent
/
{consent_token}
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const oauth = await client.oauth.retrieve('consent_token');
console.log(oauth.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
oauth = client.oauth.retrieve(
"consent_token",
)
print(oauth.data)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"),
)
oauth, err := client.OAuth.Get(context.TODO(), "consent_token")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", oauth.Data)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.oauth.OAuthRetrieveParams;
import com.telnyx.sdk.models.oauth.OAuthRetrieveResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
OAuthRetrieveResponse oauth = client.oauth().retrieve("consent_token");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
oauth = telnyx.oauth.retrieve("consent_token")
puts(oauth)<?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 {
$oauth = $client->oauth->retrieve('consent_token');
var_dump($oauth);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx oauth retrieve \
--api-key 'My API Key' \
--consent-token consent_tokencurl --request GET \
--url https://api.telnyx.com/v2/oauth/consent/{consent_token} \
--header 'Authorization: Bearer <token>'{
"data": {
"client_id": "<string>",
"name": "<string>",
"requested_scopes": [
{
"id": "<string>",
"name": "<string>",
"description": "<string>"
}
],
"logo_uri": "<string>",
"tos_uri": "<string>",
"policy_uri": "<string>",
"redirect_uri": "<string>",
"verified": true
}
}{
"error": "<string>",
"error_description": "<string>"
}Was this page helpful?
⌘I
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const oauth = await client.oauth.retrieve('consent_token');
console.log(oauth.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
oauth = client.oauth.retrieve(
"consent_token",
)
print(oauth.data)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"),
)
oauth, err := client.OAuth.Get(context.TODO(), "consent_token")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", oauth.Data)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.oauth.OAuthRetrieveParams;
import com.telnyx.sdk.models.oauth.OAuthRetrieveResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
OAuthRetrieveResponse oauth = client.oauth().retrieve("consent_token");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
oauth = telnyx.oauth.retrieve("consent_token")
puts(oauth)<?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 {
$oauth = $client->oauth->retrieve('consent_token');
var_dump($oauth);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx oauth retrieve \
--api-key 'My API Key' \
--consent-token consent_tokencurl --request GET \
--url https://api.telnyx.com/v2/oauth/consent/{consent_token} \
--header 'Authorization: Bearer <token>'{
"data": {
"client_id": "<string>",
"name": "<string>",
"requested_scopes": [
{
"id": "<string>",
"name": "<string>",
"description": "<string>"
}
],
"logo_uri": "<string>",
"tos_uri": "<string>",
"policy_uri": "<string>",
"redirect_uri": "<string>",
"verified": true
}
}{
"error": "<string>",
"error_description": "<string>"
}