Search code examples
amazon-web-servicesreact-nativeamazon-cognitoaws-amplify

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?


Solution

  • 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