import Telnyx from 'telnyx';
const client = new Telnyx();
const response = await client.oauth.token({ grant_type: 'client_credentials' });
console.log(response.access_token);{
"access_token": "<string>",
"token_type": "Bearer",
"expires_in": 123,
"scope": "<string>",
"refresh_token": "<string>"
}Exchange authorization code, client credentials, or refresh token for access token
import Telnyx from 'telnyx';
const client = new Telnyx();
const response = await client.oauth.token({ grant_type: 'client_credentials' });
console.log(response.access_token);{
"access_token": "<string>",
"token_type": "Bearer",
"expires_in": 123,
"scope": "<string>",
"refresh_token": "<string>"
}OAuth client credentials (client_id:client_secret) via HTTP Basic Auth, or client credentials in request body for public clients
OAuth 2.0 grant type
client_credentials, authorization_code, refresh_token Space-separated list of requested scopes (for client_credentials)
"admin"
Authorization code (for authorization_code flow)
Redirect URI (for authorization_code flow)
PKCE code verifier (for authorization_code flow)
Refresh token (for refresh_token flow)
OAuth client ID (if not using HTTP Basic auth)
OAuth client secret (if not using HTTP Basic auth)
Was this page helpful?