I am using spring security oauth2 client and configured the app as follow
spring.security.oauth2.client.registration.google.client-id=abcd
spring.security.oauth2.client.registration.google.client-secret=password
(403 Unauthorized)
I am stuck on this for more than a week and googled it many times with luck, since the autoconfiguration for oauth2 client is new in spring boot 2.
Update
I believe CORS is out of the reasons because the ajax calls are executed from within the web app itself, using same domain name, not from third party (like app)
After investigation, I found a solution. The solution is to override the security autoconfiguration in spring boot 2 for OAuth client. I wrote the following Security Config class
@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.anyRequest().permitAll()
.and()
.oauth2Login();
}
}
And thanks for every one who tried to help.