Oauth一直無限重定向


 

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

 

文章來源:劉俊濤的博客 歡迎關注公眾號、留言、評論,一起學習。

__________________________________________________________________________________

若有幫助到您,歡迎點擊推薦,您的支持是對我堅持最好的肯定(*^_^*)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM