GlideOAuthClient - Scoped, Global
-
- UpdatedJan 30, 2025
- 2 minutes to read
- Yokohama
- API reference
The GlideOAuthClient API provides methods for requesting and revoking OAuth refresh and access tokens.
You can use this API in global and scoped scripts. In scoped scripts use the sn_auth
namespace identifier.
GlideOAuthClient - getToken(String requestID, String oauthProfileID)
Retrieves the access and refresh tokens for the client.
Name | Type | Description |
---|---|---|
requestID | String | Request ID from the OAuth Requestor Profile [oauth_requestor_profile] table, which references the OAuth Entity Profile [oauth_entity_profile] table. |
oauthProfileID | String | OAuth profile ID from the OAuth Entity Profile [oauth_entity_profile] table. |
Type | Description |
---|---|
GlideOAuthToken | The access and refresh tokens for the client. |
Example
This example code shows how to retrieve access and refresh tokens from the instance database.
Output:
GlideOAuthClient - requestToken(String clientName, String jsonString)
Retrieves the token for the client, with the request parameters encoded in JSON format.
Name | Type | Description |
---|---|---|
clientName | String | The client name. |
jsonString | String | The JSON string for the client. |
Type | Description |
---|---|
GlideOAuthClientResponse | The token for the client. |
Example
This example shows a resource owner password grant type request, with request parameters encoded in JSON format.
GlideOAuthClient - requestTokenByRequest(String clientName, GlideOAuthClientRequest request)
Retrieves the token for the client, with the client name and the request set into a GlideOAuthClientResponse object.
Name | Type | Description |
---|---|---|
clientName | String | The client name. |
request | GlideOAuthClientRequest | The request. |
Type | Description |
---|---|
GlideOAuthClientResponse | The token for the client. |
GlideOAuthClient - revokeToken(String clientName, String accessToken, String refreshToken, GlideOAuthClientRequest request)
Revokes the access or refresh token for the client, with the request and optional header parameters set into a GlideOAuthClientRequest object.
Type | Description |
---|---|
GlideOAuthClientResponse | The token for the client. |
On this page
- GlideOAuthClient - getToken(String requestID, String oauthProfileID)
- GlideOAuthClient - requestToken(String clientName, String jsonString)
- GlideOAuthClient - requestTokenByRequest(String clientName, GlideOAuthClientRequest
request)
- GlideOAuthClient - revokeToken(String clientName, String accessToken, String refreshToken,
GlideOAuthClientRequest request)