Home > AI > Backend > SpringBoot > spring-security-oauth2 >

测试四种模式方法

一.授权码模式(需要先登陆获取授权码,再获取access_token)
1.获取code()
http://localhost:8080/oauth/authorize?response_type=code&client_id=elapse&redirect_uri=https://www.baidu.com
2.通过code获取access_token
http://localhost:8080/oauth/token?grant_type=authorization_code&code=keLf84&redirect_uri=https://www.baidu.com&client_id=elapse&client_secret=123456&scope=all


二.密码模式(发送账户密码,敏感信息暴露)
http://localhost:8080/oauth/token?client_id=elapse&client_secret=123456&grant_type=password&username=user&password=123456


三、客户端模式(最不安全,只要知道id和口令就可以获取access_token)
http://localhost:8080/oauth/token?client_id=elapse&client_secret=123456&grant_type=client_credentials

四、简化模式(与授权码一样,但无需code)
http://localhost:8080/oauth/authorize?client_id=elapse&response_type=token&scope=all&redirect_uri=https://www.baidu.com

Leave a Reply