Skip to main content

grants

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

Overview​

Namegrants
TypeResource
Idokta.users.grants

Fields​

The following fields are returned by SELECT queries:

Grant object that represents an app consent scope grant

NameDatatypeDescription
idstringID of the Grant object (example: oag3ih1zrm1cBFOiq0h6)
_embeddedobjectEmbedded resources related to the Grant
_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 of the app integration (example: oag3ih1zrm1cBFOiq0h6)
createdstring (date-time)Timestamp when the object was created (example: 2017-03-28T01:11:10.000Z)
createdByobjectUser that created the object
issuerstringThe issuer of your org authorization server. This is typically your Okta domain. (example: https://my_test_okta_org.oktapreview.com)
lastUpdatedstring (date-time)Timestamp when the object was last updated
scopeIdstringThe name of the Okta scope for which consent is granted (example: okta.users.read)
sourcestringUser type source that granted consent (ADMIN, END_USER) (example: ADMIN)
statusstringStatus (ACTIVE, REVOKED) (example: ACTIVE)
userIdstringUser ID that granted consent (if source is END_USER) (example: 00u5t60iloOHN9pBi0h7)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_grants_for_user_and_clientselectuserId, clientId, subdomainexpand, after, limitLists all grants for a specified user and client
get_user_grantselectuserId, grantId, subdomainexpandRetrieves a grant for the specified user
list_user_grantsselectuserId, subdomainscopeId, expand, after, limitLists all grants for the specified user
revoke_grants_for_user_and_clientdeleteuserId, clientId, subdomainRevokes all grants for the specified user and client
revoke_user_grantdeleteuserId, grantId, subdomainRevokes one grant for a specified user
revoke_user_grantsdeleteuserId, subdomainRevokes all grants for a specified user

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
clientIdstringclient_id of the app
grantIdstringGrant ID
subdomainstring(default: my-org)
userIdstringID of an existing Okta user
afterstringThe cursor to use for pagination. It is an opaque string that specifies your current location in the list and is obtained from the Link response header. See Pagination.
expandstringValid value: scope. If specified, scope details are included in the _embedded attribute.
limitinteger (int32)Specifies the number of grants to return
scopeIdstringThe scope ID to filter on

SELECT examples​

Lists all grants for a specified user and client

SELECT
id,
_embedded,
_links,
clientId,
created,
createdBy,
issuer,
lastUpdated,
scopeId,
source,
status,
userId
FROM okta.users.grants
WHERE userId = '{{ userId }}' -- required
AND clientId = '{{ clientId }}' -- required
AND subdomain = '{{ subdomain }}' -- required
AND expand = '{{ expand }}'
AND after = '{{ after }}'
AND limit = '{{ limit }}'
;

DELETE examples​

Revokes all grants for the specified user and client

DELETE FROM okta.users.grants
WHERE userId = '{{ userId }}' --required
AND clientId = '{{ clientId }}' --required
AND subdomain = '{{ subdomain }}' --required
;