【2020华为云AI实战营】Postman获取Token实践
Postman的版本:6.7.4
https://dl.pstmn.io/download/version/6.7.4/win64
实践接口文档地址
https://support.huaweicloud.com/api-iam/iam_30_0001.html
需要注意,因为不是IMA用户,所以请求参数中的auth.identity.password.user.domain填写自己的账号名
刚开始用curl测试
curl -ik -X POST -H 'Content-Type=application/json;charset=utf8' -d '{"auth": {"identity": {"password": {"user": {"password": "********","domain": {"name": "hw93030006"},"name": "hw93030006"}},"methods": ["password"]},"scope": {"project": {"name": "cn-north-4"}}}}' https://iam.cn-north-4.myhuaweicloud.com/v3/auth/tokens
个人密码用*******代替,需要注意不同区的请求地址是不一样的(参考https://developer.huaweicloud.com/endpoint?IAM),scope.project.name这个参数也需要填写对应的区号
用postman测试的参数为
headers
Content-Type == application/json;charset=utf8
body是为
{"auth": {"identity": {"password": {"user": {"password": "********","domain": {"name": "hw93030006"},"name": "hw93030006"}},"methods": ["password"]},"scope": {"project": {"name": "cn-north-4"}}}}
最后发下一个Postman的问题,在body进行json格式化,没能请求成功
token如图
- 点赞
- 收藏
- 关注作者
评论(0)