Having Issues Integrating OAuth2 with your Java Spring Boot Project.
Let us see what is the issue that occurs when redirecting back to your application after a successful OAuth2 Authentication -
The reason this error occurs is because when the redirect URL is set under the authorization service it is not defined as a allowed or permitted URL inside the Spring Boot Application.
The allowed or permitted URL is that URL that can be accessed without authentication also.
When the authorization service in Application redirects the Application to a non-permitted URL, it will again redirect back to the authorization service for doing further authentication. Due to this, the Application process enters into a loop that doesn't end, which further leads to ERR_TOO_MANY_REDIRECTS problem.
In order to allow the Spring Boot Application, access to the callback URL, you will have to extend WebSecurityConfigurerAdapter and override the security configuration code as follows:
In the above code, we make "/callback" our redirect URL, so we allow or permit access to it using permitAll() function but we still secure the access for other URLs.
Looking for any Software or Tutorial?
Don't Worry, we will find it for you