GlideOAuthToken - Scoped, Global
-
- UpdatedJan 30, 2025
- 2 minutes to read
- Yokohama
- API reference
The GlideOAuthToken API provides methods for retrieving OAuth access token and information about the access token.
You can use this API in global and scoped scripts. In scoped scripts use the
sn_auth
namespace identifier.
GlideOAuthToken - getAccessToken()
Retrieves the access token associated with the GlideOAuthToken object.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
String | Access token. |
Example
This example code shows how to retrieve access and refresh tokens from the instance database. See also GlideOAuthClient.
Output:
GlideOAuthToken - getAccessTokenSysID()
Deprecated. Retrieves the sys_id of the token ID associated with the GlideOAuthToken object.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
String | Sys_id of the access token. |
GlideOAuthToken - getExpiresIn()
Retrieves the lifespan of the access token associated with the GlideOAuthToken object.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
Number (Long) | Lifespan of the token. Unit: Seconds |
Example
This example code shows how to retrieve access and refresh tokens from the instance database. See also GlideOAuthClient.
Output:
GlideOAuthToken - getRefreshToken()
Refreshes the token associated with the GlideOAuthToken object.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
String | Refreshed token. |
Example
This example code shows how to retrieve access and refresh tokens from the instance database. See also GlideOAuthClient.
Output:
GlideOAuthToken - getRefreshTokenSysID()
Deprecated. Retrieves the sys_id of the refresh token.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
String | Sys_id of the refresh token. |
GlideOAuthToken - getScope()
Retrieves the token scope, which is the amount of access granted by the access token.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
String | Scope of the access token. |