本文介绍使用STS(安全令牌)中的AssumeRole(角色扮演)接口访问OSS资源时常见的错误码及错误原因。
角色扮演常见错误码及原因如下。
错误码 | 原因 |
ErrorCode: NoPermission ErrorMessage: Roles may not be assumed by root accounts. | 请使用RAM子用户的密钥信息,不要使用主账户的密钥信息,AssumeRole接口需要用RAM子用户调用。 |
ErrorCode: MissingSecurityToken ErrorMessage: SecurityToken is mandatory for this action. | 使用RAM子用户调用RAM的AssumeRole接口会生成一对STS信息,这个STS信息包含了STS的AccessKeyId、AccessSecret和SecurityToken,如果需要使用这对STS去调用其他服务的接口的时候,需要把这个三个参数都传进去。 |
Error code: InvalidAccessKeyId.NotFound Error message: Specified access key is not found | AccessKeyId无效,请检查是否写错,特别注意前后不能有空格。 |
Error code: InvalidAccessKeyId.Inactive Error message: Specified access key is disabled. | 使用的RAM子用户密钥已经被禁止,请启用密钥或更换密钥。密钥是否被禁止,请通过控制台的用户AccessKey确认并开启,登录RAM 访问控制控制台,单击 | 。
ErrorCode: InvalidParameter.PolicyGrammar ErrorMessage: The parameter Policy has not passed grammar check. | 角色扮演时指定的授权策略无效。角色扮演时可以指定授权(Policy),也可以不指定。如果指定授权策略,则临时用户的权限是指定的授权策略和角色权限的交集;如果不指定授权策略,临时用户的权限是角色的权限。报该错误时,请检查指定的授权策略Policy。不推荐临时用户扮演角色时指定授权策略。如果的确需要使用授权策略,建议您使用RAM Policy Editor生成授权策略,详情请参见RAM Policy Editor。 |
ErrorCode: InvalidParameter.RoleSessionNameErrorMessage: The parameter RoleSessionName is wrongly formed. | 角色扮演时指定RoleSessionName无效。此参数用来区分不同的Token,以标明谁在使用此Token,便于审计。格式:^[a-zA-Z0-9.@-_]+$,2-32个字符。了解更多信息请参见扮演角色操作接口。例如命名为a、1、abc\*abc、忍者神龟等都是非法的。 |
ErrorCode: InvalidParameter.DurationSeconds Error message: The Min/Max value of DurationSeconds is 15min/1hr. | 角色扮演时指定的过期时间无效,即AssumeRoleRequest.setDurationSeconds参数无效。角色扮演时可以指定过期时间,单位为秒,有效时间是900~3600秒,如assumeRoleRequest.setDurationSeconds(60L * 20),20分钟内有效。 |
ErrorCode: NoPermissionErrorMessage: No permission perform sts:AssumeRole on this Role. Maybe you are not authorized to perform sts:AssumeRole or the specified role does not trust you. |
|
Error code: NoPermission Error message: You are not authorized to do this action. You should be authorized by RAM. | 详细信息请参见STS中临时授权时出现“You are not authorized to do this action. You should be authorized by RAM“报错。 |
在文档使用中是否遇到以下问题
更多建议
匿名提交