Create Grant

POST {{apiPath}}/environments/{{envID}}/applications/{{appID}}/grants

The POST /environments/{{envID}}/applications/{{appID}}/grants operation creates a new resource access grant for the application specified in the request URL. You must specify the resource property ID to create the resource access grant. You can also identify the scopes from the resource being granted. The scopes property allows a list of scopes to associate with the resource access grant. Worker apps that have the client_credentials grant type do not support OIDC scopes.

Note: An application cannot have multiple grants that refer to the same resource, even if the scopes differ. Additionally, an application cannot have multiple grants that refer to scopes having the same name.

Prerequisites

See the Application Resource Grants for complete descriptions.

PropertyTypeRequired?
resource.idStringN/A
scopes.idString[]Required

Request Body

{"resource"=>{"id"=>"{{resourceID}}"}, "scopes"=>[{"id"=>"{{scopeID}}"}]}

RESPONSES

status: Created

{"_links":{"self":{"href":"https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/applications/cad1c86d-a6c8-4e61-b15f-8ff452698fa8/grants/c95c0f55-524c-4b7e-bbab-07ba2c47aa93"},"environment":{"href":"https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"},"application":{"href":"https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/applications/cad1c86d-a6c8-4e61-b15f-8ff452698fa8"},"resource":{"href":"https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/resources/b6f08ba7-a50b-44f0-922f-91c03f0390f8"}},"id":"c95c0f55-524c-4b7e-bbab-07ba2c47aa93","environment":{"id":"abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"},"resource":{"id":"b6f08ba7-a50b-44f0-922f-91c03f0390f8"},"application":{"id":"cad1c86d-a6c8-4e61-b15f-8ff452698fa8"},"scopes":[{"id":"a24ec929-f241-4f21-85ea-0d710910239c"}],"createdAt":"2020-02-19T20:21:31.756Z","updatedAt":"2020-02-19T20:21:31.756Z"}