'how to get the client secret from okta application using okta java sdk

I am using latest okta java sdk

application.getCredentials().get("oauthClient");

Using above I can able to get the client id, but I need client secret as well. In DefaultApplicationCredentialsOAuthClient class, I can see the method to get the client secret, but not sure how do I get that

public String getClientSecret() {
    return  getString(clientSecretProperty);
}

Please help me on this to get the client secret from okta application using Java okta sdk



Solution 1:[1]

I use this code for obtaining the clientSecret of an application:

ApplicationCredentials credentials = application.getCredentials();
String clientSecret = ((DefaultOAuthApplicationCredentials) credentials).getOAuthClient().getClientSecret();

Solution 2:[2]

You can get the client secret via secret endpoint.

GET {{okta_url}}/api/v1/apps/:appId/credentials/secrets

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 jalogar
Solution 2 Linden X. Quan