Skip to main content

client_roles

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

Overview​

Nameclient_roles
TypeResource
Idokta.oauth2.client_roles

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringRole assignment ID
_embeddedobjectOptional embedded resources for the role assignment
_linksobjectSpecifies link relations (see Web Linking) available using the JSON Hypertext Application Language specification.
assignmentTypestringRole assignment type (CLIENT, GROUP, USER)
createdstring (date-time)Timestamp when the object was created
labelstringLabel for the role assignment
lastUpdatedstring (date-time)Timestamp when the object was last updated
resource-setstringResource set ID
rolestringRole ID
statusstringStatus of the role assignment (ACTIVE, INACTIVE)
typestring| Role type | Description | |------------------------------|-------------------------------------------------------------| | ACCESS_CERTIFICATIONS_ADMIN | Access Certifications Administrator IAM-based standard role | | ACCESS_REQUESTS_ADMIN | Access Requests Administrator IAM-based standard role | | API_ACCESS_MANAGEMENT_ADMIN | Access Management Administrator standard role | | APP_ADMIN | Application Administrator standard role | | CUSTOM | Custom admin role | | GROUP_MEMBERSHIP_ADMIN | Group Membership Administrator standard role | | HELP_DESK_ADMIN | Help Desk Administrator standard role | | ORG_ADMIN | Organizational Administrator standard role | | READ_ONLY_ADMIN | Read-Only Administrator standard role | | REPORT_ADMIN | Report Administrator standard role | | SUPER_ADMIN | Super Administrator standard role | | USER_ADMIN | User Administrator standard role | | WORKFLOWS_ADMIN | Workflows Administrator IAM-based standard role | (ACCESS_CERTIFICATIONS_ADMIN, ACCESS_REQUESTS_ADMIN, API_ACCESS_MANAGEMENT_ADMIN, APP_ADMIN, CUSTOM, GROUP_MEMBERSHIP_ADMIN, HELP_DESK_ADMIN, ORG_ADMIN, READ_ONLY_ADMIN, REPORT_ADMIN, SUPER_ADMIN, USER_ADMIN, WORKFLOWS_ADMIN) (title: roleType)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
retrieve_client_roleselectclientId, roleAssignmentId, subdomainRetrieves a role assignment (identified by roleAssignmentId) for a client app (identified by clientId)
list_roles_for_clientselectclientId, subdomainLists all roles assigned to a client app identified by clientId
assign_role_to_clientinsertclientId, subdomain, type, role, resource-setAssigns a standard role to a client app.

You can also assign a custom role to a client app, but the preferred method to assign a custom role to a client is to create a binding between the custom role, the resource set, and the client app. See Create a role resource set binding.

> Notes:
> * The request payload is different for standard and custom role assignments.
> * For IAM-based standard role assignments, use the request payload for standard roles. However, the response payload for IAM-based role assignments is similar to the custom role's assignment response.
delete_role_from_clientdeleteclientId, roleAssignmentId, subdomainUnassigns a role assignment (identified by roleAssignmentId) from a client app (identified by clientId)

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
roleAssignmentIdstringThe id of the role assignment
subdomainstring(default: my-org)

SELECT examples​

Retrieves a role assignment (identified by roleAssignmentId) for a client app (identified by clientId)

SELECT
id,
_embedded,
_links,
assignmentType,
created,
label,
lastUpdated,
resource-set,
role,
status,
type
FROM okta.oauth2.client_roles
WHERE clientId = '{{ clientId }}' -- required
AND roleAssignmentId = '{{ roleAssignmentId }}' -- required
AND subdomain = '{{ subdomain }}' -- required
;

INSERT examples​

Assigns a standard role to a client app.

You can also assign a custom role to a client app, but the preferred method to assign a custom role to a client is to create a binding between the custom role, the resource set, and the client app. See Create a role resource set binding.

> Notes:
> * The request payload is different for standard and custom role assignments.
> * For IAM-based standard role assignments, use the request payload for standard roles. However, the response payload for IAM-based role assignments is similar to the custom role's assignment response.

INSERT INTO okta.oauth2.client_roles (
type,
resource-set,
role,
clientId,
subdomain
)
SELECT
'{{ type }}' /* required */,
'{{ resource-set }}' /* required */,
'{{ role }}' /* required */,
'{{ clientId }}',
'{{ subdomain }}'
RETURNING
id,
_embedded,
_links,
assignmentType,
created,
label,
lastUpdated,
resource-set,
role,
status,
type
;

DELETE examples​

Unassigns a role assignment (identified by roleAssignmentId) from a client app (identified by clientId)

DELETE FROM okta.oauth2.client_roles
WHERE clientId = '{{ clientId }}' --required
AND roleAssignmentId = '{{ roleAssignmentId }}' --required
AND subdomain = '{{ subdomain }}' --required
;