Create application in OKTA

Hi,
I’m looking to create web application in OKTA, since there is no specific builder for application.
I feel difficulty to create application in OKTA.
Could you please provide any sample snippet.

And as I used below snippet It throws error like
Okta E0000015 (You do not have permission to access the feature you are requesting), ErrorId oaepZfHw3EqSv60OJcVzo0plQ

Application app = client.createApplication(client.instantiate(AutoLoginApplication)
.setLabel(“app-${UUID.randomUUID().toString()}”)
.setVisibility(client.instantiate(ApplicationVisibility)
.setAutoSubmitToolbar(false)
.setHide(client.instantiate(ApplicationVisibilityHide)
.setIOS(false)
.setWeb(false)))
.setSettings(client.instantiate(AutoLoginApplicationSettings)
.setSignOn(client.instantiate(AutoLoginApplicationSettingsSignOn)
.setRedirectUrl(“http://swasecondaryredirecturl.okta.com”)
.setLoginUrl(“http://swaprimaryloginurl.okta.com”))))

Thanks!

Hi @gomathy

Can you please try the below example and let me know if you still get the error?

        Application oidc = client.createApplication(client.instantiate(OpenIdConnectApplication.class)
                .setLabel("Test OIDC app")
                .setSettings(
                        client.instantiate(OpenIdConnectApplicationSettings.class)
                            .setOAuthClient(client.instantiate(OpenIdConnectApplicationSettingsClient.class)
                                    .setRedirectUris(Arrays.asList("https://google.com"))
                                    .setResponseTypes(Arrays.asList(OAuthResponseType.TOKEN, OAuthResponseType.CODE))
                                    .setGrantTypes(Arrays.asList(OAuthGrantType.IMPLICIT, OAuthGrantType.AUTHORIZATION_CODE))
                                    .setApplicationType(OpenIdConnectApplicationType.NATIVE)
                            )
                )
                .setCredentials(
                        client.instantiate(OAuthApplicationCredentials.class)
                            .setOAuthClient(client.instantiate(ApplicationCredentialsOAuthClient.class)
                                    .setClientId("client-id-here")
                                    .setClientSecret("client-secret-here")
                                    .setAutoKeyRotation(true)
                                    .setTokenEndpointAuthMethod(OAuthEndpointAuthenticationMethod.NONE)
                            )
                ).setVisibility(client.instantiate(ApplicationVisibility.class)
                        .setHide(client.instantiate(ApplicationVisibilityHide.class)
                                .setIOS(true)
                                .setWeb(false)))
1 Like

Hi @dragos

Thanks alot for your immediate response.
It is really helpful.
Code is working fine…

Thanks😊