Skip to main content

tokens

Creates, updates, deletes, gets or lists a tokens resource.

Overview​

Nametokens
TypeResource
Idokta.apps.tokens

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringID of the Token object (example: oar579Mcp7OUsNTlo0g3)
_embeddedobjectThe embedded resources related to the object if the expand query parameter is specified
_linksobjectSpecifies link relations (see Web Linking) available using the JSON Hypertext Application Language specification. This object is used for dynamic discovery of related resources and lifecycle operations.
clientIdstringClient ID
createdstring (date-time)Timestamp when the object was created (example: 2017-03-28T01:11:10.000Z)
expiresAtstring (date-time)Expiration time of the OAuth 2.0 Token
issuerstringThe complete URL of the authorization server that issued the Token (example: https://{yourOktaDomain}/oauth2/ausain6z9zIedDCxB0h7)
lastUpdatedstring (date-time)Timestamp when the object was last updated
scopesarrayThe scope names attached to the Token
statusstringStatus (ACTIVE, REVOKED) (example: ACTIVE)
userIdstringThe ID of the user associated with the Token (example: 00u5t60iloOHN9pBi0h7)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_oauth2_token_for_applicationselectappId, tokenId, subdomainexpandRetrieves a refresh token for the specified app
list_oauth2_tokens_for_applicationselectappId, subdomainexpand, after, limitLists all refresh tokens for an app

> Note: The results are [paginated]https://developer.okta.com/docs/api#pagination according to the limit parameter.
> If there are multiple pages of results, the Link header contains a next link that you need to use as an opaque value (follow it, don't parse it).
revoke_oauth2_token_for_applicationdeleteappId, tokenId, subdomainRevokes the specified token for the specified app
revoke_oauth2_tokens_for_applicationdeleteappId, subdomainRevokes all OAuth 2.0 refresh tokens for the specified app. Any access tokens issued with these refresh tokens are also revoked, but access tokens issued without a refresh token aren't affected.

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
appIdstringApplication ID
subdomainstring(default: my-org)
tokenIdstringid of Token
afterstringSpecifies the pagination cursor for the next page of results. Treat this as an opaque value obtained through the next link relationship. See [Pagination]https://developer.okta.com/docs/api#pagination.
expandstringAn optional parameter to return scope details in the _embedded property. Valid value: scope
limitintegerA limit on the number of objects to return

SELECT examples​

Retrieves a refresh token for the specified app

SELECT
id,
_embedded,
_links,
clientId,
created,
expiresAt,
issuer,
lastUpdated,
scopes,
status,
userId
FROM okta.apps.tokens
WHERE appId = '{{ appId }}' -- required
AND tokenId = '{{ tokenId }}' -- required
AND subdomain = '{{ subdomain }}' -- required
AND expand = '{{ expand }}'
;

DELETE examples​

Revokes the specified token for the specified app

DELETE FROM okta.apps.tokens
WHERE appId = '{{ appId }}' --required
AND tokenId = '{{ tokenId }}' --required
AND subdomain = '{{ subdomain }}' --required
;