Closed davekats closed 3 years ago
Hi @davekats, you can assign Profile data after application is created like so:
var appCreateOptions = new CreateOpenIdConnectApplication
{
Label = label,
Activate = true,
ResponseTypes = new[] { OAuthResponseType.Code },
GrantTypes = new[] { OAuthGrantType.AuthorizationCode, OAuthGrantType.ClientCredentials },
ApplicationType = OpenIdConnectApplicationType.Service,
RedirectUris = new[] { "https://example.com" },
};
var newApp = await oktaClient.Applications.CreateApplicationAsync(appCreateOptions);
var newProfile = new Resource();
newProfile["test"] = "value123";
newApp.Profile = newProfile;
await oktaClient.Applications.UpdateApplicationAsync(newApp, newApp.Id);
Hi @andriizhegurov-okta, thanks for the workaround. This is actually what I am currently doing, however I'm hoping that there is a way to accomplish this without making a second call to Okta.
@davekats Yes, you can construct application object manually, fill all the needed properties and then persist it with a single call:
var profile = new Resource();
profile["test"] = "value123";
var app = new OpenIdConnectApplication
{
Name = "oidc_client",
Label = label,
SignOnMode = ApplicationSignOnMode.OpenIdConnect,
Settings = new OpenIdConnectApplicationSettings
{
OAuthClient = new OpenIdConnectApplicationSettingsClient()
{
ResponseTypes = new[] { OAuthResponseType.Code },
RedirectUris = new[] { "https://example.com" },
GrantTypes = new[] { OAuthGrantType.AuthorizationCode, OAuthGrantType.ClientCredentials },
ApplicationType = OpenIdConnectApplicationType.Service,
},
},
Profile = profile,
};
var newApp = await oktaClient.Applications.CreateApplicationAsync(application: app, activate: true);
@andriizhegurov-okta That's exactly what I needed. Thank you!
Current behavior
CreateOpenIdConnectApplication
does not contain a property for Profile.Expected behavior
I'd expect the Profile property to be present so that I can assign key/value pairs, lists, or any JSON friendly data.
If there is some other workaround to this please let me know. I posted this question in the dev forum as well.
Thanks!
Environment