The Redirect Loop was because the /oauth2/authorization/ endpoint was secured, thus it was triggering going back to the Web API for an access token.
I've updated my configuration to this:
原因:// OAuth檢測JSESSIONID登錄;
//當OAuth 檢測到是同一個瀏覽器已登錄OAuth,發起請求時,不再返回code,直接返回access_token;
在第三方的項目 增加 返回access_token 的邏輯即可;
或者修改Oauth項目的相關配置;
@Configuration
public class SpotifySecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/home", "/login**","/callback/", "/webjars/**", "/error**", "/oauth2/authorization/**")
.permitAll()
.anyRequest()
.authenticated()
.and()
.oauth2Login();
}
}
參考:
https://stackoverflow.com/questions/57761917/spring-5-security-oauth2-login-redirect-loop
文章來源:劉俊濤的博客 歡迎關注公眾號、留言、評論,一起學習。
__________________________________________________________________________________
若有幫助到您,歡迎點擊推薦,您的支持是對我堅持最好的肯定(*^_^*)