我正在使用Cognito的UserPool使用OpenID服务登录我的用户。
我已经将UserPool username 属性映射到联合身份的 sub 属性(默认情况下),但是在进行身份验证时,在Cognito OAuth回调之后,我得到错误“需要用户名属性映射”
我尝试放置其他属性来映射UserPool 用户名,但是遇到相同的错误,或者Cognito拒绝映射该属性。
这是我的OIDC配置:
OIDC提供程序配置:
OpenID规范:https://auth.riotgames.com/.well-known/openid-configuration
在前端,我使用:
const FederatedSignIn = async () => {
const oauth = {
domain: myDomain',
scope: ['profile', 'openid'],
redirectSignIn: 'http://localhost:8000/login',
redirectSignOut: 'http://localhost:8000/logout',
responseType: 'code',
attributes: { // I tried this but it doesn't change anything
username: 'sub',
},
}
Auth.configure({ oauth })
Auth.federatedSignIn({ customProvider: 'rso' })
}
此外,每当在范围中添加 sub 字段时,都会出现 invalid_scope 错误。.
非常感谢您的帮助!
我在这里发现了类似的问题:
我开始问自己这是否是Cognito问题,但这将非常令人惊讶。