
4pnt6 (4pnt6) asked a question.
Hello,
I am using the latest version of the Okta SDK (v10.3.0)
I am currently writing an endpoint that will create a new ApplicationIntegration for a customer that will then be assigned an AccessPolicy for an API Authorization Server. Part of the response of this endpoint should be the client_secret so that the credential may then be stored securely else where.
I see in the documentation there is the ApplicationCredentialsOAuthClient with a getClientSecret() method, but I cannot find how to pull those credentials after creating the ApplicationIntegration.
Thanks

Hi @4pnt6 (4pnt6) , Thank you for reaching out to the Okta Community!
I ran your request by my Developer colleagues and they mentioned that you might be able to do this via the API.
https://developer.okta.com/docs/reference/api/apps/#list-client-secrets
They mentioned leveraging something for the Go SDK - /api/v1/apps/%s/credentials/jwks .
For the Go Mgmt SDK this needed to be done with a custom request executor. They were kind enough to provide the following sample logic for Go:
type Keys struct {
Keys []okta.JsonWebKey `json:"keys,omitempty"`
}
var webKeys Keys
url := fmt.Sprintf("/api/v1/apps/%s/credentials/jwks", app.(*okta.Application).Id)
req, err := client.CloneRequestExecutor().NewRequest("GET", url, nil)
if err != nil {
fmt.Printf("Error creating new request: %v\n", err)
}
_, err = client.CloneRequestExecutor().Do(ctx, req, &webKeys)
if err != nil {
fmt.Printf("Error executing request: %v\n", err)
}
if len(webKeys.Keys) > 0 {
fmt.Printf("Client Secret: %+v\n", webKeys.Keys[0])
}
The Java mgmt sdk should allow calling APIs not supported by the SDK as well,
https://github.com/okta/okta-sdk-java#call-other-api-endpoints
The logic will need to be similar to the above Go code.
My advice would be to reach out to the dedicated Developer Forum devforum.okta.com to take advantage of their expertise.
While we'll do our best to answer all of your questions here, this medium is more inclined towards Okta core products and features (non-developer work).
Hope my answer helps!
--------------------------------
Community members help others by clicking Like or Select as Best on responses. Try it today.
Very interesting, and thank you for pointing me towards the devforum.
I'll do my best to look into this further. I definitely glazed over the bit of code you've also mentioned in the github link, and I see how that will be immediately very helpful to me