我已经为IBM Cloud生成了API密钥,如何以编程方式从API密钥生成令牌?
这是一个curl请求。
curl --location --request POST 'https://iam.cloud.ibm.com/identity/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Basic Yng6Yng=' \
--data-urlencode 'apikey=xxx' \
--data-urlencode 'response_type=cloud_iam' \
--data-urlencode 'grant_type=urn:ibm:params:oauth:grant-type:apikey'
替换xxx
为您的API密钥。
基本授权是base64编码的,用户名是bx
,密码是bx
。
响应如下所示:
{
"access_token": "bearer token",
"refresh_token": "refresh token",
"token_type": "Bearer",
"expires_in": 3600,
"expiration": 1581031424,
"scope": "ibm openid"
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句