用户登录 WSO2 身份服务器后如何获取用户属性

时间:2021-03-25 13:17:18

标签: wso2 wso2is wso2carbon

这是我的步骤

我的 OAuth 端点: https://localhost:9443/oauth2/authorize/?response_type=code&client_id=xxxx&scope=openid&redirect_uri=http://localhost/gatewaytest/Home/WsoCallBack

然后我得到了代码并由此得到了访问令牌 "https://localhost:9443/oauth2/token"

然后我调用这个端点 "https://localhost:9443/oauth2/userinfo?schema=openid"

然后我得到了这样的结果 {"sub":"Alexwso1.com"}

我如何获得其他属性,例如电子邮件、电话

1 个答案:

答案 0 :(得分:1)

  1. 导航到 WSO2 IS 中的服务提供商配置(路径 通过管理控制台:主菜单->服务提供商->列表-> 选择 SP),然后展开“声明配置”。

  2. 然后为你需要的用户属性添加相应的声明, 在 requested claims 部分。

enter image description here

通过开始获取授权代码、访问令牌和用户信息来重新执行您的流程。如果您在步骤 (2) 中添加的本地声明映射到 http://wso2.org/oidc/claim 方言中的 oidc 声明,您将能够获取该用户信息。

否则请遵循本指南https://medium.com/@inthiraj1994/lets-add-a-custom-claim-to-oidc-in-wso2-is-d871e418d6b0

相关问题