通过代码获取用户的 WSO2 端点是什么

What is the WSO2 endpoint to get the user by code

我通过在 wso2 idp 服务器中调用它获得了代码。 “https://localhost:9443/oauth2/authorize/?response_type=code&client_id=xxxxxxxxxx&scope=openid profile&state=xy25q6ghkz&redirect_uri=http://localhost/gatewaytest/Home/WsoCallBack”

然后我在用户登录后收到了我的应用程序代码。然后我如何通过这段代码获取用户详细信息。 登录用户后通过代码获取用户的 WSO2 端点是什么。

  1. 检索 id token(因为您已通过 openid 范围)调用令牌端点。
curl -k -X POST https://localhost:9443/oauth2/token -H 'Authorization: Basic <base64encoded(client_id:client_secret)>' -H 'Content-Type: application/x-www-form-urlencoded' -d 'grant_type=authorization_code&code=<authorization_code>&redirect_uri=<callback_url>'

一旦 id_token 被解码(使用 https://jwt.io/),您就可以看到用户信息。

  1. 从上述请求中获取访问令牌并调用 userinfo 端点
curl -k -H "Authorization: Bearer <Acess_token>" https://localhost:9443/oauth2/userinfo?schema=openid

更多详情请参考以下内容。

  1. https://is.docs.wso2.com/en/latest/learn/basic-client-profile-with-playground/
  2. https://medium.com/identity-beyond-borders/generating-access-tokens-using-wso2-identity-server-4d8c084a3bf5
  3. https://www.youtube.com/watch?v=Bj8ob_I_DKo