amplify-js: Auth.federatedSignIn error: `AuthClass - Cannot get the current user because the user pool is missing.`

Describe the bug Auth.federatedSignIn throws a console error AuthClass - Cannot get the current user because the user pool is missing., but works as expected finally by authenticating successfully after that.

I have AWS Identity pool configured with OpenID Connection as Auth provider to authenticate for multiple Google ClientIds. I am not using any cognito user-pool. From my react-native app, using Amplify SDK, I call Auth.federatedSignIn passing it the idToken obtained from Google SignIn. Everything is working good, AWS finally authenticates successfully and allows to access lambdas.

Expected behavior Auth.federatedSignIn should authenticate without throwing any console error

Screenshots ( the error is highlighted in console in below gif )

gfgh

Below is how I have Amplify Auth configured: gfgh2

Smartphone (please complete the following information):

  • Device: [iPhone Simulator, Android Simulator ]
  • OS: [ iPhone X simulator 12.1, Android Nexus 5x API28]

Additional context “aws-amplify”: “^1.1.19”, “aws-amplify-react-native”: “^2.1.7”

Tried removing/adding above packages to have latest versions.

You can turn on the debug mode to provide more info for us by setting window.LOG_LEVEL = ‘DEBUG’; in your app.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 7
  • Comments: 15 (7 by maintainers)

Most upvoted comments

Mine was fixed by going from:

import Amplify from '@aws-amplify/core'
import config from './aws-exports'
Amplify.configure(config)

to

import Amplify from 'aws-amplify'
import config from './aws-exports'
Amplify.configure(config)

We are getting the same thing. AuthClass - Cannot get the current user because the user pool is missing. Please make sure the Auth module is configured with a valid Cognito User Pool ID

This page suggests that user pool id is optional. https://aws-amplify.github.io/docs/js/authentication#manual-setup

On the other hand this code suggests that it’s not optional: https://github.com/aws-amplify/amplify-js/blob/master/packages/auth/src/types/Auth.ts#L36

We want to use an identity pool without specifying a user pool. Inside that identity pool we want to add 3 user pools as Cognito Authentication Providers. Is this possible?

I was going through this tutorial https://aws-amplify.github.io/docs/js/tutorials/building-react-native-apps/ and got the error mentioned about and I removed Auth by doing Amplify remove auth, after which I published the changes then re-add auth and I was able to get the application working. Have you tried that @bharat-tiwari