作为联合用户,必须使用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/
您从SoftLayer指南中引用的代码片段具有设置SoftLayer用户名和API密钥的结果:
echo "SL_USERNAME: $SL_USERNAME"
echo "SL_API_KEY: $SL_API_KEY"
这是一种迂回的方法,可以查找与用户配置文件中列出的API用户名和身份验证密钥相同的信息。如果您没有看到API用户名和身份验证密钥,您可以在"用户列表"中您的姓名旁边的"操作"菜单上创建一个。
然后您可以执行基础结构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代币展开讨论。如果以上建议不充分,请提供更多关于您正在努力实现的目标的指导。