Skip to main contenttelnyx-oauth-javascript
Implement OAuth 2.0 authentication flows for Telnyx API access. This skill provides JavaScript SDK examples.
الانتقال إلى التثبيت التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
يتجاوز الأمر المباشر Prompt المخصّص للمراجعة. افحص المصدر قبل تشغيله.
npx skills add https://github.com/team-telnyx/telnyx-toolkit --skill telnyx-oauth-javascriptيبقى الأمر في سطر واحد. مرّر أفقيًا لمراجعته كاملًا قبل النسخ.
تفضّل نسخة محلية؟ نزّل الملفات المتاحة حاليًا لدى SkillsMP.
المزيد من هذا المستودع
Complete Telnyx toolkit — ready-to-use tools (STT, TTS, RAG, Networking, 10DLC) plus SDK documentation for JavaScript, Python, Go, Java, and Ruby.
Automated Telnyx bot account signup via challenge-response
Track agent activities using the Telnyx AI Missions API. Use this skill when executing multi-step tasks that should be logged and tracked. Supports creating voice/SMS agents, scheduling calls, and retrieving conversation insights. Use when tasks involve calling people, sending SMS, or any substantial tracked work.
SOC
استنادا إلى تصنيف SOC المهني
| name | telnyx-oauth-javascript |
| description | Implement OAuth 2.0 authentication flows for Telnyx API access. This skill provides JavaScript SDK examples. |
| metadata | {"author":"telnyx","product":"oauth","language":"javascript","generated_by":"telnyx-ext-skills-generator"} |
Telnyx Oauth - JavaScript
Installation
npm install telnyx
Setup
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'],
});
All examples below assume client is already initialized as shown above.
Authorization server metadata
OAuth 2.0 Authorization Server Metadata (RFC 8414)
GET /.well-known/oauth-authorization-server
const response = await client.wellKnown.retrieveAuthorizationServerMetadata();
console.log(response.authorization_endpoint);
Protected resource metadata
OAuth 2.0 Protected Resource Metadata for resource discovery
GET /.well-known/oauth-protected-resource
const response = await client.wellKnown.retrieveProtectedResourceMetadata();
console.log(response.authorization_servers);
OAuth authorization endpoint
OAuth 2.0 authorization endpoint for the authorization code flow
await client.oauth.retrieveAuthorize({
client_id: 'client_id',
redirect_uri: 'https://example.com',
response_type: 'code',
});
List OAuth clients
Retrieve a paginated list of OAuth clients for the authenticated user
for await (const oauthClient of client.oauthClients.list()) {
console.log(oauthClient.client_id);
}
Create OAuth client
Create a new OAuth client
POST /oauth/clients — Required: name, allowed_scopes, client_type, allowed_grant_types
const oauthClient = await client.oauthClients.create({
allowed_grant_types: ['client_credentials'],
allowed_scopes: ['admin'],
client_type: 'public',
name: 'My OAuth client',
});
console.log(oauthClient.data);
Get OAuth client
Retrieve a single OAuth client by ID
const oauthClient = await client.oauthClients.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');
console.log(oauthClient.data);
Update OAuth client
Update an existing OAuth client
const oauthClient = await client.oauthClients.update('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');
console.log(oauthClient.data);
Delete OAuth client
DELETE /oauth/clients/{id}
await client.oauthClients.delete('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');
Get OAuth consent token
Retrieve details about an OAuth consent token
GET /oauth/consent/{consent_token}
const oauth = await client.oauth.retrieve('consent_token');
console.log(oauth.data);
List OAuth grants
Retrieve a paginated list of OAuth grants for the authenticated user
for await (const oauthGrant of client.oauthGrants.list()) {
console.log(oauthGrant.id);
}
Get OAuth grant
Retrieve a single OAuth grant by ID
const oauthGrant = await client.oauthGrants.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');
console.log(oauthGrant.data);
Revoke OAuth grant
DELETE /oauth/grants/{id}
const oauthGrant = await client.oauthGrants.delete('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');
console.log(oauthGrant.data);
Token introspection
Introspect an OAuth access token to check its validity and metadata
POST /oauth/introspect — Required: token
const response = await client.oauth.introspect({ token: 'token' });
console.log(response.client_id);
JSON Web Key Set
Retrieve the JSON Web Key Set for token verification
const response = await client.oauth.retrieveJwks();
console.log(response.keys);
Dynamic client registration
Register a new OAuth client dynamically (RFC 7591)
const response = await client.oauth.register();
console.log(response.client_id);
OAuth token endpoint
Exchange authorization code, client credentials, or refresh token for access token
POST /oauth/token — Required: grant_type
const response = await client.oauth.token({ grant_type: 'client_credentials' });
console.log(response.access_token);