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 (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
list_oauth2_tokens_for_applicationselectsubdomainexpand, 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).
get_oauth2_token_for_applicationselectsubdomainexpandRetrieves a refresh token for the specified app
revoke_oauth2_tokens_for_applicationdeletesubdomainRevokes 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.
revoke_oauth2_token_for_applicationdeletesubdomainRevokes the specified token for the specified app

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
subdomainstringThe domain of your organization. This can be a provided subdomain of an official okta domain (okta.com, oktapreview.com, etc) or one of your configured custom domains. (default: my-org)
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

Lists 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).

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

DELETE examples

Revokes 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.

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