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

How to get user properties after user log into WSO2 identity server

这是我的步骤

我的 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”

然后我得到了这样的结果 {“子”:“Alexwso1.com”}

如何获取其他属性,例如电子邮件,phone

  1. 导航到 WSO2 IS 中的服务提供商配置(路径 通过管理控制台:Main Menu-> Service Providers -> List -> Select SP),展开“声明配置”。

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

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

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