Trying something very simple and that I have done many times using an HttpClient and calling the APIs myself. Just added the SDK Nuget and am trying to make the following call:
When I break and investigate a single Application from the collection I see:
It appears to be there, I can drill into the Settings and see the Grants at the bottom node. However, I cannot reference it - at all:
What am I missing as I delve into this SDK? I’ve spent most of a day on this already and the help files have been rather less than helpful.
TIA
-kb
Seems no one knows the answer - and there are no documents for the SDK itself. Turns out, Settings is not part of the returned object definition.
Turns out there are variations on a theme for this call and the result needs to be cast to the actual call type you are making. For instance:
var manager = new OktaApiManager(AuthorizationMode.BearerToken, request.BearerToken);
var userApps = await manager.ApplicationApi.ListApplications(cancellationToken: cancellationToken) as OpenIdConnectApplication; // Cast the resulting object!
If you look at the Application object in the Okta Model space you will see:
//
// Summary:
// Template: ModelGeneric Application
[DataContract(Name = "Application")]
[JsonConverter(typeof(JsonSubtypes), new object[] { "SignOnMode" })]
[JsonSubtypes.KnownSubType(typeof(AutoLoginApplication), "AUTO_LOGIN")]
[JsonSubtypes.KnownSubType(typeof(AutoLoginApplication), "AutoLoginApplication")]
[JsonSubtypes.KnownSubType(typeof(BasicAuthApplication), "BASIC_AUTH")]
[JsonSubtypes.KnownSubType(typeof(BookmarkApplication), "BOOKMARK")]
[JsonSubtypes.KnownSubType(typeof(BrowserPluginApplication), "BROWSER_PLUGIN")]
[JsonSubtypes.KnownSubType(typeof(BasicAuthApplication), "BasicAuthApplication")]
[JsonSubtypes.KnownSubType(typeof(BookmarkApplication), "BookmarkApplication")]
[JsonSubtypes.KnownSubType(typeof(BrowserPluginApplication), "BrowserPluginApplication")]
[JsonSubtypes.KnownSubType(typeof(OpenIdConnectApplication), "OPENID_CONNECT")]
[JsonSubtypes.KnownSubType(typeof(OpenIdConnectApplication), "OpenIdConnectApplication")]
[JsonSubtypes.KnownSubType(typeof(SamlApplication), "SAML_1_1")]
[JsonSubtypes.KnownSubType(typeof(SamlApplication), "SAML_2_0")]
[JsonSubtypes.KnownSubType(typeof(SecurePasswordStoreApplication), "SECURE_PASSWORD_STORE")]
[JsonSubtypes.KnownSubType(typeof(SamlApplication), "SamlApplication")]
[JsonSubtypes.KnownSubType(typeof(SecurePasswordStoreApplication), "SecurePasswordStoreApplication")]
[JsonSubtypes.KnownSubType(typeof(WsFederationApplication), "WS_FEDERATION")]
[JsonSubtypes.KnownSubType(typeof(WsFederationApplication), "WsFederationApplication")]
public class Application : IEquatable<Application>
{
.....
}
Just be aware that Okta Models may have various casted variations!
1 Like
system
Closed
February 24, 2024, 5:51pm
4
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.