Oauth2的遇坑一点提示(Spring Security Oauth2 / Cloud)

1)使用@EnableOAuth2Sso的网页客户端,登录是成功的可是总是像没成功一样。

    提示错误:没有

    症结:context-path没设置,或者设置为/(ROOT)

  参考资料:https://spring.io/guides/tutorials/spring-boot-oauth2/#_social_login_simple

  

  简单说就是服务器和客户机都在localhost上时,cookie会区分不了。。

2)认证服务器,跳转授权都没问题,但是token就是没法取,不是401就是莫名其妙出先一个登录页面。(旧版没发现,在GreenWich/boot 2.1.4上发现的)

  提示错误:WARN- Encoded password does not look like BCrypt

  症结:client_secret需要BCrypt加密。(旧版可以不加密)

  例如:withClient("client1").secret(passwordEncoder.encode("secret1"))

  参考资料:https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.0-Migration-Guide

                         https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/html/spring-boot-features.html#boot-features-security-oauth2

       https://docs.spring.io/spring-security-oauth2-boot/docs/current/reference/htmlsingle/

       https://blog.csdn.net/m0_37834471/article/details/81162121?utm_source=blogxgwz5

原文地址:https://www.cnblogs.com/kaixuanpisces/p/10805399.html