樓主這里有個需求:當token過期后 重新獲取token 并回傳過期那頁 這里主要依賴前端實作
xx.xx為前端
xx1.xx1為后端
1.當前端在 xx.xx/user token失效
2.原本獲取 http://192.168.xx1.xx1:6001/oauth/authorize?client_id=user-vue&response_type=code 那么現在改成 http://192.168.xx1.xx1:6001/oauth/authorize?client_id=user-vue&response_type=code&redirect_uri=http://192.168.xx.xx:8080/excessive?
redirectTo=http://192.168.xx.xx:8080/user
注意:redirect_uri地址需要與oauth_client_details表中的web_server_redirect_uri欄位相同 否則會報錯
redirectTo中的地址為當前過期頁面地址

3.這時候跳轉到登錄頁面 當登錄成功后 跳轉到http://192.168.xx.xx:8080/excessive(表中配置)頁面 同時后面跟著http://192.168.xx.xx:8080/excessive?redirectTo=http://192.168.xx.xx:8080/user&code=BqMKx7
4.在excessive頁面中 首先呼叫/oauth/token 獲取token 然后跳轉到redirectTo=http://192.168.xx.xx:8080/user

轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/258446.html
標籤:其他
上一篇:Json初步了解
下一篇:提交代碼到GitHub
