[英]WSO2 Identity and Oauth2 - Userinfo throws Error: Insufficient Scope
使用以下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服务器读取userinfo数据。
我已经隔离了问题。 需要将范围值放在对授权码的初始请求中,并在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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.