Okta.Sdk.Api.ApplicationGrantsApi
October 22, 2025 ยท View on GitHub
All URIs are relative to https://subdomain.okta.com
| Method | HTTP request | Description |
|---|---|---|
| GetScopeConsentGrant | GET /api/v1/apps/{appId}/grants/{grantId} | Retrieve an app grant |
| GrantConsentToScope | POST /api/v1/apps/{appId}/grants | Grant consent to scope |
| ListScopeConsentGrants | GET /api/v1/apps/{appId}/grants | List all app grants |
| RevokeScopeConsentGrant | DELETE /api/v1/apps/{appId}/grants/{grantId} | Revoke an app grant |
GetScopeConsentGrant
OAuth2ScopeConsentGrant GetScopeConsentGrant (string appId, string grantId, string expand = null)
Retrieve an app grant
Retrieves a single scope consent Grant object for the app
Example
using System.Collections.Generic;
using System.Diagnostics;
using Okta.Sdk.Api;
using Okta.Sdk.Client;
using Okta.Sdk.Model;
namespace Example
{
public class GetScopeConsentGrantExample
{
public static void Main()
{
Configuration config = new Configuration();
config.OktaDomain = "https://subdomain.okta.com";
// Configure API key authorization: apiToken
config.Token ="YOUR_API_KEY";
// Configure OAuth2 access token for authorization: oauth2
config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new ApplicationGrantsApi(config);
var appId = 0oafxqCAJWWGELFTYASJ; // string | Application ID
var grantId = iJoqkwx50mrgX4T9LcaH; // string | Grant ID
var expand = scope; // string | An optional parameter to return scope details in the `_embedded` property. Valid value: `scope` (optional)
try
{
// Retrieve an app grant
OAuth2ScopeConsentGrant result = apiInstance.GetScopeConsentGrant(appId, grantId, expand);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling ApplicationGrantsApi.GetScopeConsentGrant: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| appId | string | Application ID | |
| grantId | string | Grant ID | |
| expand | string | An optional parameter to return scope details in the `_embedded` property. Valid value: `scope` | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | Success | - |
| 403 | Forbidden | - |
| 404 | Not Found | - |
| 429 | Too Many Requests | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
GrantConsentToScope
OAuth2ScopeConsentGrant GrantConsentToScope (string appId, OAuth2ScopeConsentGrant oAuth2ScopeConsentGrant)
Grant consent to scope
Grants consent for the app to request an OAuth 2.0 Okta scope
Example
using System.Collections.Generic;
using System.Diagnostics;
using Okta.Sdk.Api;
using Okta.Sdk.Client;
using Okta.Sdk.Model;
namespace Example
{
public class GrantConsentToScopeExample
{
public static void Main()
{
Configuration config = new Configuration();
config.OktaDomain = "https://subdomain.okta.com";
// Configure API key authorization: apiToken
config.Token ="YOUR_API_KEY";
// Configure OAuth2 access token for authorization: oauth2
config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new ApplicationGrantsApi(config);
var appId = 0oafxqCAJWWGELFTYASJ; // string | Application ID
var oAuth2ScopeConsentGrant = new OAuth2ScopeConsentGrant(); // OAuth2ScopeConsentGrant |
try
{
// Grant consent to scope
OAuth2ScopeConsentGrant result = apiInstance.GrantConsentToScope(appId, oAuth2ScopeConsentGrant);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling ApplicationGrantsApi.GrantConsentToScope: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| appId | string | Application ID | |
| oAuth2ScopeConsentGrant | OAuth2ScopeConsentGrant |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 201 | Created | - |
| 400 | Bad Request | - |
| 403 | Forbidden | - |
| 404 | Not Found | - |
| 429 | Too Many Requests | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ListScopeConsentGrants
List<OAuth2ScopeConsentGrant> ListScopeConsentGrants (string appId, string expand = null)
List all app grants
Lists all scope consent Grants for the app
Example
using System.Collections.Generic;
using System.Diagnostics;
using Okta.Sdk.Api;
using Okta.Sdk.Client;
using Okta.Sdk.Model;
namespace Example
{
public class ListScopeConsentGrantsExample
{
public static void Main()
{
Configuration config = new Configuration();
config.OktaDomain = "https://subdomain.okta.com";
// Configure API key authorization: apiToken
config.Token ="YOUR_API_KEY";
// Configure OAuth2 access token for authorization: oauth2
config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new ApplicationGrantsApi(config);
var appId = 0oafxqCAJWWGELFTYASJ; // string | Application ID
var expand = scope; // string | An optional parameter to return scope details in the `_embedded` property. Valid value: `scope` (optional)
try
{
// List all app grants
List<OAuth2ScopeConsentGrant> result = apiInstance.ListScopeConsentGrants(appId, expand).ToListAsync();
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling ApplicationGrantsApi.ListScopeConsentGrants: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| appId | string | Application ID | |
| expand | string | An optional parameter to return scope details in the `_embedded` property. Valid value: `scope` | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | Success | - |
| 403 | Forbidden | - |
| 404 | Not Found | - |
| 429 | Too Many Requests | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
RevokeScopeConsentGrant
void RevokeScopeConsentGrant (string appId, string grantId)
Revoke an app grant
Revokes permission for the app to grant the given scope
Example
using System.Collections.Generic;
using System.Diagnostics;
using Okta.Sdk.Api;
using Okta.Sdk.Client;
using Okta.Sdk.Model;
namespace Example
{
public class RevokeScopeConsentGrantExample
{
public static void Main()
{
Configuration config = new Configuration();
config.OktaDomain = "https://subdomain.okta.com";
// Configure API key authorization: apiToken
config.Token ="YOUR_API_KEY";
// Configure OAuth2 access token for authorization: oauth2
config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new ApplicationGrantsApi(config);
var appId = 0oafxqCAJWWGELFTYASJ; // string | Application ID
var grantId = iJoqkwx50mrgX4T9LcaH; // string | Grant ID
try
{
// Revoke an app grant
apiInstance.RevokeScopeConsentGrant(appId, grantId);
}
catch (ApiException e)
{
Debug.Print("Exception when calling ApplicationGrantsApi.RevokeScopeConsentGrant: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| appId | string | Application ID | |
| grantId | string | Grant ID |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 204 | No Content | - |
| 403 | Forbidden | - |
| 404 | Not Found | - |
| 429 | Too Many Requests | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]