文档首页/ 企业管理/ API参考/ 附录/ 获取Domain级Token
更新时间:2025-04-15 GMT+08:00

获取Domain级Token

以下示例展示如何获取Domain级Token。

POST https://iam.cn-north-1.myhuaweicloud.com/v3/auth/tokens
Content-Type: application/json

{
    "auth": {
        "identity": {
            "methods": [
                "password"
            ],
            "password": {
                "user": {
                    "name": "username",
                    "password": "********",
                    "domain": {
                        "name": "domainname"
                    }
                }
            }
        },
        "scope": {
            "domain": {
                "id": "xxxxxxxxxxxxxxxxxx"
            }
        }
    }
}
  • token的有效期为24小时,建议进行缓存,避免频繁调用。
  • 使用Token前请确保Token离过期有足够的时间,防止调用API的过程中Token过期导致调用API失败。