Outbound Apps with SDKs

You can use the Descope management SDK to fetch, delete, and manage Outbound App tokens. The management SDK requires a management key, which can be generated from the Company Settings page of the Descope console.

Note

Currently, Outbound App management functions are only supported in the Java SDK. You can use our API directly if you are using another backend framework.

Install SDK

// Include the following in your `pom.xml` (for Maven)
<dependency>
    <artifactId>java-sdk</artifactId>
    <groupId>com.descope</groupId>
    <version>sdk-version</version> // Check https://github.com/descope/descope-java/releases for the latest versions
</dependency>

Import and initialize Management SDK

import com.descope.client;
 
// Initialized after setting the DESCOPE_PROJECT_ID env var (and optionally DESCOPE_MANAGEMENT_KEY)
var descopeClient = new DescopeClient();
 
// ** Or directly **
var descopeClient = new DescopeClient(Config.builder()
        .projectId("__ProjectID__")
        .managementKey("management-key")
        .build());
 
// Set up the outbound apps service
OutboundAppsService outboundAppsService = descopeClient.getManagementServices().getOutboundAppsService();

Delete Outbound App Token by Token ID

This operation deletes a specific outbound app token by its token ID.

// Args:
//   tokenId (String): The token ID to delete
try {
    outboundAppsService.deleteOutboundAppTokenById("token-id");
} catch (DescopeException de) {
    // Handle the error
}

Delete All Outbound App Tokens for a User

This operation deletes all outbound app tokens for a given user and app.

// Args:
//   appId (String): Outbound app ID (required)
//   userId (String): User ID (required)
try {
    outboundAppsService.deleteOutboundAppUserTokens(
        DeleteOutboundAppUserTokensRequest.builder()
            .appId("app-id")
            .userId("user-id")
            .build()
    );
} catch (DescopeException de) {
    // Handle the error
}
Was this helpful?

On this page