Docs
api
Security Token Service(STS)
AssumeRole

Obtain temporary identity credentials for the role played - AssumeRole

Overview

Obtain temporary identity credentials for the role played

Definition

Public Parameters

Parameter NameTypeDescription InformationRequired
ActionstringCorresponding API command name, the current API is AssumeRole.Yes
PublicKeystringThe user's public key can be obtained from Console (opens in a new tab)Yes
SignaturestringUser signature generated based on public key and API command, see Signature AlgorithmYes

Request Parameters

Parameter NameTypeDescription InformationRequired
RoleUrnstringThe URN of the IAM role to be assumed.Yes
RoleSessionNamestringRole session name. The format allows 1-64 characters composed of letters, numbers, underscores (_), hyphens (-), and English periods (.).Yes
DurationSecondsintToken validity period, unit: seconds. The minimum value is 900, and the maximum value is limited by the maximum session time configured for the role.No
PolicystringAn additional permission policy added for the STS Token, further limiting the permissions of the STS Token.No

Response Field

Field NameTypeDescription InformationRequired
RetCodeintReturn status code. If it is 0, it means successful return. If it is not 0, it means failure.Yes
ActionstringOperation command name.Yes
MessagestringReturns an error message, providing detailed description when RetCode is non-zero.No
CredentialsCredentialsAccess Token.No

Data Model

Credentials

Field NameTypeDescription InformationRequired
SecurityTokenstringSecurity Token.Yes
AccessKeyIdstringKey ID.Yes
AccessKeySecretstringSecret Key.Yes
ExpirationstringToken expiration time (UTC time).Yes

Example

Request Example

https://api.ucloud-global.com/?Action=AssumeRole
&RoleUrn=FwesBQjA
&RoleSessionName=jFbSZIhm
&DurationSeconds=1
&Policy=BhQicCmh

Response Example

{
  "Action": "AssumeRoleResponse",
  "Credentials": {},
  "RetCode": 0
}