zoukankan      html  css  js  c++  java
  • spring security oauth2设置错误信息为json格式

    背景:

    spring security oauth2默认的错误信息返回格式是xml,如果要返回json,可以在请求头中指定'Accept: application/json'。

    指定为json示例

    curl -i -L -H 'Accept: application/json' --data 'client_id=0000-0003-2736-8061&client_secret=5f63d1c5-3f08-4fa5-b066-fd985ffd0df7&grant_type=authorization_code&code=Q70Y3A&redirect_uri=https://developers.google.com/oauthplayground' 'http://api.sandbox-1.orcid.org/oauth/token'

    指定为xml示例

    curl -i -L -H 'Accept: application/xml' --data 'client_id=0000-0003-2736-8061&client_secret=5f63d1c5-3f08-4fa5-b066-fd985ffd0df7&grant_type=authorization_code&code=Q70Y3A&redirect_uri=https://developers.google.com/oauthplayground' 'http://api.sandbox-1.orcid.org/oauth/token'

    测试:

    没有指定JSON:

     

    指定为JSON之后:

    Header 中添加Accept  application/json

     

  • 相关阅读:
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    flutter webview_flutter 设置cookies
    flutter richText富文本
    flutter 安卓再次点击返回退出应用
  • 原文地址:https://www.cnblogs.com/Edward-Wang/p/13182845.html
Copyright © 2011-2022 走看看