【问题标题】:WSO2 Identity and Oauth2 - Userinfo throws Error: Insufficient ScopeWSO2 身份和 Oauth2 - Userinfo 抛出错误:范围不足
【发布时间】:2015-08-21 14:15:11
【问题描述】:

使用以下 Python 代码测试 Oauth2 的 oauth2/userprofile 查询:

        verify='/home/claudef/tmp/oauth2/oauth/wso2.pem'
        url  = "https://extbasicpacman05.podc.sl.edst.red.com:9443/oauth2/userinfo?schema=openid"
        headers = { 'Authorization' : "Bearer " + access_token } 
        r = requests.get(url, headers=headers, verify=verify)

我从 WSO2 身份服务器收到以下错误消息:

error":"insufficient_scope","error_description":"Access token does not have the openid scope"

检查从不记名令牌发射返回的数据,我看到默认值 scope=profile,它与 userinfo 查询中的默认值不匹配,可能使用值 scope=openid。

u'token_type': u'bearer', u'scope': u'profile', u'access_token': u'7ae4542fe322d3aba67bf0625039d5f6', u'expires_in': 73, u'refresh_token': u'92d915a25d8bef6ca7ec7b70664c5cbf'}

使用 cURL 命令时也会出现同样的错误。

请给我一些指导如何解决此问题以从 WSO2 服务器读取用户信息数据。

【问题讨论】:

    标签: wso2 token identity wso2is


    【解决方案1】:

    我已经隔离了这个问题。需要在授权码的初始请求中放置范围值,从 Oauth2 身份验证序列的开头添加参数。添加“scope=openid”参数,如下所示,修复了问题

    <a href="https://extbasicpacman05.podc.sl.edst.red.com:9443/oauth2/authorize?client_id=SXpu7Iaz13YoxM6uT6Lhcu1ixlga&response_type=code&scope=openid&redirect_uri=http://localhost:8080/resources/oauth2Callback&requestedAuthnPolicy=http://www.ibm.com/idaas/authnpolicy/basic">Login via Oauth2</a>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-10-02
      • 2022-11-11
      • 2019-12-23
      • 2019-07-06
      • 2017-03-10
      • 1970-01-01
      • 2021-12-12
      • 2019-04-27
      相关资源
      最近更新 更多