Okta.Sdk.Api.ApplicationTokensApi

October 22, 2025 ยท View on GitHub

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

MethodHTTP requestDescription
GetOAuth2TokenForApplicationGET /api/v1/apps/{appId}/tokens/{tokenId}Retrieve an application token
ListOAuth2TokensForApplicationGET /api/v1/apps/{appId}/tokensList all application refresh tokens
RevokeOAuth2TokenForApplicationDELETE /api/v1/apps/{appId}/tokens/{tokenId}Revoke an application token
RevokeOAuth2TokensForApplicationDELETE /api/v1/apps/{appId}/tokensRevoke all application tokens

GetOAuth2TokenForApplication

OAuth2RefreshToken GetOAuth2TokenForApplication (string appId, string tokenId, string expand = null)

Retrieve an application token

Retrieves a refresh token for the specified 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 GetOAuth2TokenForApplicationExample
    {
        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 ApplicationTokensApi(config);
            var appId = 0oafxqCAJWWGELFTYASJ;  // string | Application ID
            var tokenId = sHHSth53yJAyNSTQKDJZ;  // string | `id` of Token
            var expand = scope;  // string | An optional parameter to return scope details in the `_embedded` property. Valid value: `scope` (optional) 

            try
            {
                // Retrieve an application token
                OAuth2RefreshToken result = apiInstance.GetOAuth2TokenForApplication(appId, tokenId, expand);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling ApplicationTokensApi.GetOAuth2TokenForApplication: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

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

Return type

OAuth2RefreshToken

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]

ListOAuth2TokensForApplication

List<OAuth2RefreshToken> ListOAuth2TokensForApplication (string appId, string expand = null, string after = null, int? limit = null)

List all application refresh tokens

Lists all refresh tokens for an app > Note: The results are paginated according to the limit parameter. > If there are multiple pages of results, the Link header contains a next link that you need to use as an opaque value (follow it, don't parse it).

Example

using System.Collections.Generic;
using System.Diagnostics;
using Okta.Sdk.Api;
using Okta.Sdk.Client;
using Okta.Sdk.Model;

namespace Example
{
    public class ListOAuth2TokensForApplicationExample
    {
        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 ApplicationTokensApi(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) 
            var after = 16275000448691;  // string | Specifies the pagination cursor for the next page of results. Treat this as an opaque value obtained through the next link relationship. See [Pagination](/#pagination). (optional) 
            var limit = 20;  // int? | A limit on the number of objects to return (optional)  (default to 20)

            try
            {
                // List all application refresh tokens
                List<OAuth2RefreshToken> result = apiInstance.ListOAuth2TokensForApplication(appId, expand, after, limit).ToListAsync();
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling ApplicationTokensApi.ListOAuth2TokensForApplication: " + 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]
afterstringSpecifies the pagination cursor for the next page of results. Treat this as an opaque value obtained through the next link relationship. See Pagination.[optional]
limitint?A limit on the number of objects to return[optional] [default to 20]

Return type

List<OAuth2RefreshToken>

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]

RevokeOAuth2TokenForApplication

void RevokeOAuth2TokenForApplication (string appId, string tokenId)

Revoke an application token

Revokes the specified token for the specified 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 RevokeOAuth2TokenForApplicationExample
    {
        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 ApplicationTokensApi(config);
            var appId = 0oafxqCAJWWGELFTYASJ;  // string | Application ID
            var tokenId = sHHSth53yJAyNSTQKDJZ;  // string | `id` of Token

            try
            {
                // Revoke an application token
                apiInstance.RevokeOAuth2TokenForApplication(appId, tokenId);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling ApplicationTokensApi.RevokeOAuth2TokenForApplication: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

NameTypeDescriptionNotes
appIdstringApplication ID
tokenIdstring`id` of Token

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]

RevokeOAuth2TokensForApplication

void RevokeOAuth2TokensForApplication (string appId)

Revoke all application tokens

Revokes all OAuth 2.0 refresh tokens for the specified app. Any access tokens issued with these refresh tokens are also revoked, but access tokens issued without a refresh token aren't affected.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Okta.Sdk.Api;
using Okta.Sdk.Client;
using Okta.Sdk.Model;

namespace Example
{
    public class RevokeOAuth2TokensForApplicationExample
    {
        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 ApplicationTokensApi(config);
            var appId = 0oafxqCAJWWGELFTYASJ;  // string | Application ID

            try
            {
                // Revoke all application tokens
                apiInstance.RevokeOAuth2TokensForApplication(appId);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling ApplicationTokensApi.RevokeOAuth2TokensForApplication: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

NameTypeDescriptionNotes
appIdstringApplication 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]