oauth2 四種授權模式

支持的授權模式

password,client_credentials,authorization_code,refresh_token,implicit

一 授權碼模式

 

  1. 先提交相信的信息去獲取一個一次性code

http://127.0.0.1:8888/oauth/authorize?client_id=admin&response_type=code&scop=all&redirect_uri=http://www.baidu.com

--------------------------成功跳轉------------------------

 

 

 

 

  1. 拿到第一步的code之後,再去獲取access_token·(POST)

http://127.0.0.1:8888/oauth/token?client_id=admin&client_secret=admin&grant_type=authorization_code&redirect_uri=http://www.baidu.com&code=GMxKrE

  1. 得到令牌

 

二、簡化模式

說明:提供相應的參數直接把token返回

http://127.0.0.1:8888/oauth/authorize?client_id=admin&response_type=token&scop=all&redirect_uri=http://www.baidu.com

 

三 賬號密碼模式

http://127.0.0.1:8888/oauth/token?client_id=admin&client_secret=admin&grant_type=password&username=admin&password=123456POST

 

 

四 客戶端模式(安全性最差)

客戶端攜帶客戶端標識和祕鑰還有授權類型即可

http://127.0.0.1:8888/oauth/token?client_id=admin&client_secret=admin&grant_type=client_credentials

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章