【问题标题】:What is the WSO2 endpoint to get the user by code通过代码获取用户的 WSO2 端点是什么
【发布时间】:2021-06-21 23:56:00
【问题描述】:

我通过在 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端点是什么。

【问题讨论】:

    标签: wso2 wso2is wso2carbon


    【解决方案1】:
    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

    【讨论】:

      猜你喜欢
      • 2015-03-19
      • 2012-08-09
      • 2012-10-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多