简体   繁体   中英

AWS Cognito: Getting error in Auth.signIn (Validate that amazon-cognito-identity-js has been linked)

I'm new to Amplify integration with Cognito and working on a react-native app using Amplify with Cognito for Authentication. I have configured the user pool and Federated Identity in the AWS console.

I have created my own signup and login interface with the respective screens using the react-navigation 5.x version. Below are the AWS related modules I added in package.json

"@aws-amplify/auth": "^3.4.24",
"@aws-amplify/core": "^3.8.16",

Here is the Amplify configuration in the App.js

 Amplify.configure({ 
  Auth: { 
    identityPoolId: 'eu-west-2:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
    region: 'eu-west-2',
    userPoolId: 'eu-west-2_xxxxxxxx',
    userPoolWebClientId: 'xxxxxxxxxxxxxxxxxxxxxx',
    authenticationFlowType: 'USER_PASSWORD_AUTH'
  }
});

I'm able to successfully invoke Auth.signUp but getting error when I'm trying to invoke Auth.signIn(username, password)

Validate that amazon-cognito-identity-js has been linked

How do I able to invoke Auth.signIn successfully, please help in resolving the issue?

I had the same problem and I fix it by installing cognito identity. Run the following:

npm i amazon-cognito-identity-js

After install start again rn

npm start

If you're running on ios, in addition to installing amazon-cognito-identity-js as mentioned, remember to also run pod install

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM