无效的登录令牌。缺少必需的声明:访问AWS Cognito AssumeRoleWithWebIdentity时听到 [英] Invalid login token. Missing a required claim: aud when accessing AWS Cognito AssumeRoleWithWebIdentity

查看:137
本文介绍了无效的登录令牌。缺少必需的声明:访问AWS Cognito AssumeRoleWithWebIdentity时听到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Cognito中设置了用户池,并在通过cognito js sdk对创建的用户进行身份验证后获得了JWT令牌。当我尝试调用假定RoleWithWebIdentity api时,它返回错误,下面是示例api调用。

I've set up the user pool in Cognito and got the JWT token after authenticating the created user via cognito js sdk. And when I try to invoke the assumeRoleWithWebIdentity api it returns an error, below is the sample api call.

https://sts.amazonaws.com/
?Action=AssumeRoleWithWebIdentity
&DurationSeconds=3600
&RoleSessionName=app1
&RoleArn=arn:aws:iam::id:role/_cross_account_role
&WebIdentityToken=jwtAccessToken
&Version=2011-06-15

api响应

<ErrorResponse xmlns="https://sts.amazonaws.com/doc/2011-06-15/">
<Error>
<Type>Sender</Type>
<Code>InvalidIdentityToken</Code>
<Message>Missing a required claim: aud</Message>
</Error>
<RequestId>c01780d7-3705-11e8-80ef-533aa2d4f58f</RequestId>
</ErrorResponse>

如果我能知道此问题的根本原因,那就太好了。

Would be great if I could know the root cause for this issue.

推荐答案

对用户进行身份验证后,它会提供访问令牌和ID令牌。

When the user is autheticated it gives an access token and ID token.

当您尝试使用访问令牌而不是ID令牌。

The issue occurs when you try to use the access token instead of the ID token.

这篇关于无效的登录令牌。缺少必需的声明:访问AWS Cognito AssumeRoleWithWebIdentity时听到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆