Spring MVC + Okta

Hi All,

I am working on to integrate Okta in my Spring MVC project, I searched for Spring projects with Okta but I am finding only Okta with Spring boot project, could you help me with my query to integrate Okta in any spring MVC project?


The Okta Spring SDK uses Spring Boot. This SDK relies on Spring Security for most the functionality.

Spring Security has a predefined OAuth provider for Okta, see here.

The following tutorial demonstrates OAuth with Spring Security in both Spring, and Spring Boot.

Hopefully that helps get you started.

Thank You,

1 Like

Thank you so much! I will take a look and come back with any questions.

I tried following this blog and having the below issue. Any help in this regard is much appreciated!

public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// all other requests
// set logout URL
.addLogoutHandler(new CustomLogoutHandler())
// enable OAuth2/OIDC
.defaultSuccessUrl(β€œ/loginSuccess.rest”, true);;
return http.build();

It kicks in Okta login widget and after login it’s going in a loop and not returning to the client application.