tencent cloud

文档反馈

GetFederationToken

最后更新时间:2022-08-16 10:31:44

1. API Description

Domain name for API request: sts.tencentcloudapi.com.

This API is used to get temporary credentials for a federated user.

A maximum of 600 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: GetFederationToken.
Version Yes String Common Params. The value used for this API: 2018-08-13.
Region Yes String Common Params. For more information, please see the list of regions supported by the product.
Name Yes String The customizable name of the caller, consisting of letters
Policy Yes String Policy description
Note:
1. The policy needs to be URL-encoded (if you request a TencentCloud API through the GET method, all parameters must be URL-encoded again in accordance with Signature v3 before the request is sent).
2. For the policy syntax, please see CAM's Syntax Logic.
3. The policy cannot contain the principal element.
DurationSeconds No Integer The validity period of temporary credentials in seconds. Default value: 1,800s. Maximum value for a root account: 7,200s. Maximum value for a sub-account: 129,600s.

3. Output Parameters

Parameter Name Type Description
Credentials Credentials Temporary credentials
ExpiredTime Integer Temporary credentials expiration time. A Unix timestamp will be returned which is accurate to the second
Expiration String Credentials expiration time in UTC time in ISO 8601 format.
Note: this field may return null, indicating that no valid values can be obtained.
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Getting temporary credentials

This example shows you how to grant the temporary credentials with the following permissions:
{"version":"2.0","statement":[{"effect":"allow","action":["name/cos:PutObject"],"resource":["qcs::cos:ap-beijing:uid/123456:prefix//123456/bucketA/*"]}]}

Note: As the GET request URL-encodes all parameters, the Policy parameter in the following example has been URL-encoded twice.

Input Example

https://sts.tencentcloudapi.com/?Action=GetFederationToken
&Name=SUN
&Policy=%257B%2522version%2522%3A%25222.0%2522%2C%2522statement%2522%3A%255B%257B%2522effect%2522%3A%2522allow%2522%2C%2522action%2522%3A%255B%2522name%2Fcos%3APutObject%2522%255D%2C%2522resource%2522%3A%255B%2522qcs%3A%3Acos%3Aap-beijing%3Auid%2F123456%3Aprefix%2F%2F123456%2FbucketA%2F%2A%2522%255D%257D%255D%257D
&<Common request parameters>

Output Example

{
  "Response": {
    "Credentials": {
      "Token": "kTRtHpOSOCUzTVWmzlPKweHffXjT9Izo7b61a142d6b56d31c0a7ace4d22bcff3zpbsXKTIrCo43dRRh7bDIKE1ZOE1KRYHEm0KNLjWG_aSF63YoQWchg-l7eXMInxXIc65HqXPjnouCcnQC98J8wEXGfE-X74QQ4kqdZXvvtgJ4yNUyDFRRkgdWtroOk0zQu4Y-h2N6pQU0FyMLSExd3UwGXpNe-CwqgNw9LTMDdz7LwsiQ9QgVCYSBdGaZXH_kOOfbAQFEDzW_8LId2mJG7DNPQMfpvc8pU_uNi0CZuQr686kYm3pLFg09UNHvB5ddn1m5SOBQRfLCK5Esdk4reSu5xw-KdZjJH2U0nZvXPU0JFrRNni1ouUdZiMpXKeZvxiooPMXtyOa_6ZTcdxjOMJfNx6pBOMWnBBJ9ShMV3S6t6AV3QSvCyvwH7dFQBXT9FPY8KK4uqRW168Q2kVt5dDdWqbRHbNg2ofhnUyHRMgYgKhtPFEAj4pJlorgWpyWtGMCGdCqnQkZ-gPOHEG0alJwveCB7CGU-K06cIGA2tZWWVr7wQRF6PrN5hWXnGI-M3hfEy1KX0degBEsjOMD4ORq2OOFvRiROln03wtBwSFCc0IhpYxCiHTsb3IAz69aU8_KEScc3ARNha5wk5L7XmyOaq9PXV5gcmV9Tw4-uO6DFwkgNPWhEyEkNYa8odPaJdrB7y8MVD_XAG92yjd5nuen7TRLCbS_0n2TbaKBZik4B_Pgxxh2QtzHfsqYdPRCzXACvhaIvnRO176cK0cgo4YKe_lTU-eqXuuoy-pqDEY2R_5ERV_UmLts89TgWVFPSGRJTQHFmLQ8RuGugenUP063kE_vAgtu0JWYn09sm1cjzJcG6E1ZJgJEWhB3LsUuhLuYn3HtwK6R65e4c3D0YKYiTzFdv3jK9aG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7hYOgvdJ4ZKzB4HfpB6xIv8v8mFaqZb4dM0ng4KRfQDmq2CUdamJA9MTCU5jTJfNUnGy7M0DCwJMQZRlOmUaVMzKTWkHCnBXEJAgOd3nzYXug3xAKTGKPtcsvoJKM1XawG2-EWPRFAaVn11wThx-SRLcZakynQsu_9VgWiE4qdoSVUGmjExw6vqjqkbiuizZ5zPzzC9cZkwtfoGkdR9DzMmf5etNrGmKJgvJBuNwUWlMJb7m",
      "TmpSecretId": "AKIDw7dwZbmFSup9CnAOraJ7skiPMybaV3WPP5B4oVMCIL5kLyphV_3IyAHFJ5QMCjE6",
      "TmpSecretKey": "/lvEo280/AlGt4orjDl9tWLIOMl5nkexS5Pg+xys7ps="
    },
    "ExpiredTime": 1547696355,
    "RequestId": "59a5e07e-4147-4d2e-a808-dca76ac5b3fd"
  }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
InternalError.DbError Database error.
InternalError.EncryptError Encryption failed.
InternalError.GetAppIdError Failed to get the appid.
InternalError.GetSeedTokenError Failed to obtain the token.
InternalError.SystemError Internal system error, such as network error.
InvalidParameter.AccountNotAvaliable The account does not exist or is unavailable.
InvalidParameter.ExtendStrategyOverSize The extension policy is too large.
InvalidParameter.GrantOtherResource Unauthorized access to the resource.
InvalidParameter.OverTimeError The expiration time exceeds the threshold.
InvalidParameter.ParamError Invalid parameter.
InvalidParameter.PolicyTooLong The policy is too long.
InvalidParameter.ResouceError Six-segment resource description error.
InvalidParameter.StrategyFormatError Policy syntax error.
InvalidParameter.StrategyInvalid Invalid policy.
InvalidParameter.TempCodeNotAvaliable Invalid temporary code.
ResourceNotFound.RoleNotFound The role corresponding to the account does not exist.
UnauthorizedOperation Unauthorized operation.
联系我们

联系我们,为您的业务提供专属服务。

技术支持

如果你想寻求进一步的帮助,通过工单与我们进行联络。我们提供7x24的工单服务。

7x24 电话支持