Token introspection
Introspect an OAuth access token to check its validity and metadata
POST
/
oauth
/
introspect
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx();
const response = await client.oauth.introspect({ token: 'token' });
console.log(response.client_id);from telnyx import Telnyx
client = Telnyx()
response = client.oauth.introspect(
token="token",
)
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.WithClientID("My Client ID"),
option.WithClientSecret("My Client Secret"),
)
response, err := client.OAuth.Introspect(context.TODO(), telnyx.OAuthIntrospectParams{
Token: "token",
})
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.OAuthIntrospectParams;
import com.telnyx.sdk.models.oauth.OAuthIntrospectResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
OAuthIntrospectParams params = OAuthIntrospectParams.builder()
.token("token")
.build();
OAuthIntrospectResponse response = client.oauth().introspect(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(client_id: "My Client ID", client_secret: "My Client Secret")
response = telnyx.oauth.introspect(token: "token")
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(
clientID: getenv('TELNYX_CLIENT_ID') ?: 'My Client ID',
clientSecret: getenv('TELNYX_CLIENT_SECRET') ?: 'My Client Secret',
);
try {
$response = $client->oauth->introspect(token: 'token');
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx oauth introspect \
--client-id 'My Client ID' \
--client-secret 'My Client Secret' \
--token tokencurl --request POST \
--url https://api.telnyx.com/v2/oauth/introspect \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'token=<string>'{
"active": true,
"scope": "<string>",
"client_id": "<string>",
"exp": 123,
"iat": 123,
"iss": "<string>",
"aud": "<string>"
}{
"error": "invalid_request"
}{
"error": "invalid_client"
}Body
application/x-www-form-urlencodedapplication/json
The token to introspect
Was this page helpful?
⌘I
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx();
const response = await client.oauth.introspect({ token: 'token' });
console.log(response.client_id);from telnyx import Telnyx
client = Telnyx()
response = client.oauth.introspect(
token="token",
)
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.WithClientID("My Client ID"),
option.WithClientSecret("My Client Secret"),
)
response, err := client.OAuth.Introspect(context.TODO(), telnyx.OAuthIntrospectParams{
Token: "token",
})
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.OAuthIntrospectParams;
import com.telnyx.sdk.models.oauth.OAuthIntrospectResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
OAuthIntrospectParams params = OAuthIntrospectParams.builder()
.token("token")
.build();
OAuthIntrospectResponse response = client.oauth().introspect(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(client_id: "My Client ID", client_secret: "My Client Secret")
response = telnyx.oauth.introspect(token: "token")
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(
clientID: getenv('TELNYX_CLIENT_ID') ?: 'My Client ID',
clientSecret: getenv('TELNYX_CLIENT_SECRET') ?: 'My Client Secret',
);
try {
$response = $client->oauth->introspect(token: 'token');
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx oauth introspect \
--client-id 'My Client ID' \
--client-secret 'My Client Secret' \
--token tokencurl --request POST \
--url https://api.telnyx.com/v2/oauth/introspect \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'token=<string>'{
"active": true,
"scope": "<string>",
"client_id": "<string>",
"exp": 123,
"iat": 123,
"iss": "<string>",
"aud": "<string>"
}{
"error": "invalid_request"
}{
"error": "invalid_client"
}