Okta.Sdk.Api.ApplicationGrantsApi

October 22, 2025 ยท View on GitHub

All URIs are relative to https://subdomain.okta.com

MethodHTTP requestDescription
GetScopeConsentGrantGET /api/v1/apps/{appId}/grants/{grantId}Retrieve an app grant
GrantConsentToScopePOST /api/v1/apps/{appId}/grantsGrant consent to scope
ListScopeConsentGrantsGET /api/v1/apps/{appId}/grantsList all app grants
RevokeScopeConsentGrantDELETE /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

NameTypeDescriptionNotes
appIdstringApplication ID
grantIdstringGrant ID
expandstringAn optional parameter to return scope details in the `_embedded` property. Valid value: `scope`[optional]

Return type

OAuth2ScopeConsentGrant

Authorization

apiToken, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
200Success-
403Forbidden-
404Not Found-
429Too 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

NameTypeDescriptionNotes
appIdstringApplication ID
oAuth2ScopeConsentGrantOAuth2ScopeConsentGrant

Return type

OAuth2ScopeConsentGrant

Authorization

apiToken, oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
201Created-
400Bad Request-
403Forbidden-
404Not Found-
429Too 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

NameTypeDescriptionNotes
appIdstringApplication ID
expandstringAn optional parameter to return scope details in the `_embedded` property. Valid value: `scope`[optional]

Return type

List<OAuth2ScopeConsentGrant>

Authorization

apiToken, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
200Success-
403Forbidden-
404Not Found-
429Too 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

NameTypeDescriptionNotes
appIdstringApplication ID
grantIdstringGrant ID

Return type

void (empty response body)

Authorization

apiToken, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
204No Content-
403Forbidden-
404Not Found-
429Too Many Requests-

[Back to top] [Back to API list] [Back to Model list] [Back to README]