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

Created on 24 Jan 2019  路  14Comments  路  Source: aws-amplify/amplify-js

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.

Auth pending-close-response-required

Most helpful comment

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)

All 14 comments

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?

@bharat-tiwari thanks for your feedback, I will take a look into that issue.

@vkulov If you want to use signIn, signUp with Amplify like Auth.signIn(...) you need to configure the userpool. Amplify currently supports only one userpool configure to do that. Cognito federated identities technically supports multiple User Pool but I never tried that with amplify. I can take a look to see if it works doing federatedSignIn.

Also getting this error. User pool is not configured, would like to use Federated Identities (GG, FB) only.

Same as @vkulov here.

@kingtut @sebastienfi @vkulov I usually have that problem when is duplicated aws-amplify on my node_modules can you double check inside your app on ./node_modules/aws-amplify-react-native if there is another node_modules with aws-amplify on it?

C:\repos\app>yarn list --pattern "aws-*"
yarn list v1.13.0
warning Resolution field "[email protected]" is incompatible with requested version "[email protected]"
warning Resolution field "[email protected]" is incompatible with requested version "[email protected]"
warning Resolution field "[email protected]" is incompatible with requested version "graphql@^0.11.7"
warning Resolution field "@types/[email protected]" is incompatible with requested version "@types/[email protected]"
鈹溾攢 @aws-amplify/[email protected]
鈹溾攢 @aws-amplify/[email protected]
鈹溾攢 @aws-amplify/[email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹斺攢 [email protected]
Done in 0.29s.

Complete yarn list is here

I'm getting this issue as well. Is there a suggested workaround?

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)

I tried @lorensr solution but did not work for me. I still get the same issue. What I did see is that even though I get the error, the user is logged in anyway

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

@lorensr worked for me.

@bharat-tiwari, any update on the responses above?

This issue has been automatically closed because of inactivity. Please open a new issue if are still encountering problems.

Updating the packages worked for me:

npm update

Was this page helpful?
0 / 5 - 0 ratings

Related issues

leantide picture leantide  路  3Comments

callmekatootie picture callmekatootie  路  3Comments

epicfaace picture epicfaace  路  3Comments

karlmosenbacher picture karlmosenbacher  路  3Comments

shinnapatthesix picture shinnapatthesix  路  3Comments