federated google sign in issue (aws amplify and Vue js)



我用vue js和aws amplify cognito设置google auth。在第一次签名时,我得到这个消息

Sign in failure ValidationException: 1 validation error detected: Value '{xxx.amazonaws.com/xxx}' at 'logins' failed to satisfy constraint: Map value must satisfy constraint: [Member must have length less than or equal to 50000, Member must have length greater than or equal to 1]

第二次签到时(按下按钮)签到良好。

为什么不工作第一次登录,为什么得到这个消息?

配置:

const awsmobile = {
"aws_project_region": "ap-south-1",
"aws_cognito_identity_pool_id": "ap-south-1:25071751-c943-443a-94ab-62c6b0f1c496",
"aws_cognito_region": "ap-south-1",
"aws_user_pools_id": "ap-south-1_NAZCqoylw",
"aws_user_pools_web_client_id": "38a1itpo95f3tgln6vq43u3u4o",
"oauth": {
"domain": "mobileweb-dev.auth.ap-south-1.amazoncognito.com",
"scope": [
"phone",
"email",
"openid",
"profile",
"aws.cognito.signin.user.admin"
],
//"redirectSignIn": "https://test-kutumbh-app.netlify.app/home",
// "redirectSignOut": "https://test-kutumbh-app.netlify.app",
//"redirectSignIn": "https://dev-kutumbh-app.netlify.app/home",
//"redirectSignOut": "https://dev-kutumbh-app.netlify.app",
"redirectSignIn": "http://localhost:3000/home",
"redirectSignOut": "http://localhost:3000",
"responseType": "code"
},
"federationTarget": "COGNITO_USER_POOLS"
};

export default awsmobile;
enter code here

输入图片描述

默认情况下,Amplify将在Safari/Chrome中打开Cognito Hosted UI,但您可以通过提供自定义URL打开器来覆盖该行为。

根据Ashish-Nanda的意见,解决使用InAppBrowser将给定URL转换为所需表单的问题。

Amplify.configure({
...config, oauth: {
...config.oauth,
urlOpener: async function urlOpener(url, redirectUrl) {
await InAppBrowser.isAvailable();
const { type, url: newUrl } = await InAppBrowser.openAuth(url, redirectUrl, {
showTitle: false,
enableUrlBarHiding: true,
enableDefaultShare: false,
ephemeralWebSession: false,
});
const splitUrl = `myapp://?${newUrl.split("#_=_")[0].split("?")[1] || ''}`;
if (type === 'success') {
Linking.openURL(splitUrl);
}
}
}
})