Skip to main content

grants

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

Overview​

Namegrants
TypeResource
Idokta.apps.grants

Fields​

The following fields are returned by SELECT queries:

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
get_scope_consent_grantselectappId, grantId, subdomainexpandRetrieves a single scope consent Grant object for the app
list_scope_consent_grantsselectappId, subdomainexpandLists all scope consent Grants for the app
grant_consent_to_scopeinsertappId, subdomain, issuer, scopeIdGrants consent for the app to request an OAuth 2.0 Okta scope
revoke_scope_consent_grantdeleteappId, grantId, subdomainRevokes permission for the app to grant the given scope

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
grantIdstringGrant ID
subdomainstring(default: my-org)
expandstringAn optional parameter to return scope details in the _embedded property. Valid value: scope

SELECT examples​

Retrieves a single scope consent Grant object for the app

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

INSERT examples​

Grants consent for the app to request an OAuth 2.0 Okta scope

INSERT INTO okta.apps.grants (
issuer,
scopeId,
appId,
subdomain
)
SELECT
'{{ issuer }}' /* required */,
'{{ scopeId }}' /* required */,
'{{ appId }}',
'{{ subdomain }}'
RETURNING
id,
_embedded,
_links,
clientId,
created,
createdBy,
issuer,
lastUpdated,
scopeId,
source,
status,
userId
;

DELETE examples​

Revokes permission for the app to grant the given scope

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