We are implementing authorization for our Spring Boot Web Application through the Company’s Okta Server. The idea is to allow users to sign in to the company’s Okta dashboard and then click on our application from there. However, we are not able to redirect users to our application API call. We have the following configuration on the Okta Application:
Sign In Redirect URI: https://backend-web-api.com/authorization-code/callback
Login Initiated By: Either Okta or APP
Login Flow: Redirect to app to initiate login(OIDC compliant)
Initiate Login URI: https://backend-web-api.com/user/authorize
We have the controller with the /user/authorize but the request is not getting redirected to this controller which we mentioned in the Initiate Login URI Requests
We are using the Okta spring Boot starter (2.1.7), Spring boot starter parent version 2.7.3 and following Security Config code
http
.csrf().disable()
.authorizeRequests()
.antMatchers(HttpMethod.OPTIONS).permitAll()
.antMatchers("/resources/**", "/registration").permitAll()
.antMatchers("/user/authorize*").authenticated()
.and()
.logout().logoutSuccessUrl("/").permitAll()
.and()
.oauth2Client()
.and()
.oauth2Login();
http.oauth2Login(Customizer.withDefaults());
http.oauth2ResourceServer(oauth2-> oauth2.jwt(Customizer.withDefaults()));
return http.build();
}```
Properties file for the same as below:
```okta.oauth2.issuer=https://company-url.org/oauth2/default
okta.oauth2.client-id=####
okta.oauth2.client-secret=########
okta.oauth2.redirect-uri=/authorization-code/callback
The error we are getting is Invalid Credentials and here is the attached screenshot for the same
Following is the network tab when we click on our application link through Okta dashboard.