Class: OAuthManagementClient
Defined in: src/management/oauth-management.ts:29
Client for OAuth token management operations.
Constructors
Constructor
new OAuthManagementClient(opts): OAuthManagementClient;
Defined in: src/management/oauth-management.ts:34
Parameters
| Parameter | Type |
|---|---|
opts | OAuthManagementClientOptions |
Returns
OAuthManagementClient
Methods
invalidateToken()
invalidateToken(token, body): Promise<string>;
Defined in: src/management/oauth-management.ts:57
Invalidate an OAuth token.
Parameters
| Parameter | Type | Description |
|---|---|---|
token | string | The OAuth token to invalidate. |
body | objectOutputType | Client ID and customer app. |
Returns
Promise<string>
Confirmation string.
Example
import { ManagementClient } from '@cdot65/prisma-airs-sdk';
const mgmt = new ManagementClient(); // reads PANW_MGMT_* env vars
const result = await mgmt.oauth.invalidateToken('old-token', {
client_id: 'cid',
customer_app: 'app1',
});
// result => 'token invalidated'
getAccessToken()
getAccessToken(opts): Promise<objectOutputType<{
token_type: ZodOptional<ZodString>;
issued_at: ZodOptional<ZodString>;
client_id: ZodOptional<ZodString>;
access_token: ZodString;
expires_in: ZodOptional<ZodString>;
status: ZodOptional<ZodString>;
}, ZodTypeAny, "passthrough">>;
Defined in: src/management/oauth-management.ts:88
Get an OAuth token for client credentials.
Parameters
| Parameter | Type | Description |
|---|---|---|
opts | GetTokenOptions | Token request options. |
Returns
Promise<objectOutputType<{
token_type: ZodOptional<ZodString>;
issued_at: ZodOptional<ZodString>;
client_id: ZodOptional<ZodString>;
access_token: ZodString;
expires_in: ZodOptional<ZodString>;
status: ZodOptional<ZodString>;
}, ZodTypeAny, "passthrough">>
OAuth2 token response.
Example
import { ManagementClient } from '@cdot65/prisma-airs-sdk';
const mgmt = new ManagementClient(); // reads PANW_MGMT_* env vars
const token = await mgmt.oauth.getAccessToken({
body: { client_id: 'cid', customer_app: 'app1' },
tokenTtlInterval: 3,
tokenTtlUnit: 'hours',
});
// token =>
// { access_token: 'new-token', expires_in: '86400', token_type: 'Bearer' }