【问题标题】:How do we retrieve user ID and iam token with below curl request?我们如何通过以下 curl 请求检索用户 ID 和 iam 令牌?
【发布时间】:2018-11-19 15:34:59
【问题描述】:

作为联合用户,它必须使用 API 密钥或一次性密码进行身份验证。我试图执行以下 curl 请求:-

示例:-

输入:-

curl -s -u 'bx:bx' -k -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' -d "grant_type=password&response_type=cloud_iam,ims_portal&username=${1}&password=${2}&ims_account=${3}" https://iam.ng.bluemix.net/oidc/token

输出:-

"errorMessage":"You cannot authenticate with user name and password, as you are a federated user","errorDetails":"Your user id '<<><><>>' is federated and must use an API key or one-time passcode to authenticate"

但是我们如何对用户进行身份验证以生成 iam_token 和 iam_user_id?

参考:- https://softlayer.github.io/rest/IBMidtoSLKey/

【问题讨论】:

    标签: ibm-cloud ibm-cloud-infrastructure


    【解决方案1】:

    您从 SoftLayer 指南中引用的代码 sn-p 具有设置 SoftLayer 用户名和 API 密钥的结果:

    echo "SL_USERNAME: $SL_USERNAME"
    echo "SL_API_KEY: $SL_API_KEY"
    

    这是一种迂回的方式来查找与您的User Profile 中列出的 API 用户名和身份验证密钥相同的信息。如果您没有看到 API 用户名和身份验证密钥,您可以在 User List 中您的姓名旁边的操作菜单上创建一个。

    然后您可以执行基础架构 API,我希望这是最终目标。

    export IAAS_USERNAME=<API Username>
    export IAAS_KEY=<Authentication Key>
    curl -u $IAAS_USERNAME:$IAAS_KEY https://api.softlayer.com/rest/v3/SoftLayer_Account/getAllBillingItems
    

    目前还不清楚是否有必要围绕 IAM 代币进行讨论。如果上述建议不充分,请提供有关您要达到的目标的更多指导。

    【讨论】:

      猜你喜欢
      • 2019-04-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-07
      • 2020-07-14
      • 2013-04-16
      • 2014-02-22
      • 2012-05-24
      • 2013-02-24
      相关资源
      最近更新 更多