spring oauth2獲取token時WARN:Could not decode JSON for additional information: BaseClientDetails解決辦法


錯誤描述

簡述:oauth_client_details表中additional_information字段默認為null,ClientDetails實體類中類型為Map<String,Object>

 

 

 

 

 

以下是官方文檔對該字段的說明
additional_information 這是一個預留的字段,在Oauth的流程中沒有實際的使用,可選,但若設置值,必須是JSON格式的數據,如:{“country”:“CN”,“country_code”:“086”}按照spring-security-oauth項目中對該字段的描述 Additional information for this client, not need by the vanilla OAuth protocol but might be useful, for example,for storing descriptive information. (詳見ClientDetails.java的getAdditionalInformation()方法的注釋)在實際應用中, 可以用該字段來存儲關於客戶端的一些其他信息,如客戶端的國家,地區,注冊時的IP地址等等.create_time 數據的創建時間,精確到秒,由數據庫在插入數據時取當前系統時間自動生成(擴展字段)
 

所以該字段存儲時格式必須為 json格式數據
{"country":"CN","country_code":"086"}
 

oauth_client_details表數據是在頁面維護的,當前端傳入additional_information值為空並不是為null或者不符合json格式,所以用該組參數獲取token時會WARN警告

解決辦法:

傳入json格式參數

前端不傳入該字段,使用數據庫默認為null

原文鏈接:https://blog.csdn.net/qphelloworld/java/article/details/106692454


免責聲明!

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



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