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 (example: ADMIN)
statusstringStatus (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_scope_consent_grantsselectsubdomainexpandLists all scope consent Grants for the app
get_scope_consent_grantselectsubdomainexpandRetrieves a single scope consent Grant object for the app
grant_consent_to_scopeinsertsubdomain, data__issuer, data__scopeIdGrants consent for the app to request an OAuth 2.0 Okta scope
revoke_scope_consent_grantdeletesubdomainRevokes 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
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)
expandstringAn optional parameter to return scope details in the _embedded property. Valid value: scope

SELECT examples

Lists all scope consent Grants for the app

SELECT
id,
_embedded,
_links,
clientId,
created,
createdBy,
issuer,
lastUpdated,
scopeId,
source,
status,
userId
FROM okta.apps.grants
WHERE 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 (
data__issuer,
data__scopeId,
subdomain
)
SELECT
'{{ issuer }}' --required,
'{{ scopeId }}' --required,
'{{ 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 subdomain = '{{ subdomain }}' --required;