2

I currently have an AWS Amplify app (modified to work with Serverless) configured to allow third-party federation with a Cognito User Pool. Because the Cognito Hosted UI's styling can't be fully customized, I've taken to bypassing it by signing in (and signing out) like so:

Auth.federatedSignIn({ provider: 'Google' })

Auth.signOut()

When signing in, my app is able to successfully request authentication with Google, and I am prompted for my email and password. This also signs me into my Google account, which I believe is common in an OAuth 2.0 authentication flow.

The issue arises when I sign out of my Google account and my app. Upon doing so and signing into my app again, I am logged in automatically. Interestingly, I am not logged into my Google account again. It's as if my app skips the step to authenticate against Google. This still happens when I clear cookies, local storage, and restart my browser.

Surprisingly, using the Hosted UI doesn't suffer from this problem. Logging out of Google and then logging into my app requires re-authentication every time.

I am otherwise unable to figure out how my browser (Chrome, Firefox, and Safari) is able to "remember" who I am as a Google user when logging into my app. Like I mentioned, I tried clearing cookies and local data, and restarting my browser. This isn't an issue in Incognito mode. I tried looking through the source code to see where some data might be set in storage, but Amplify mostly seems to rely on local storage by default, which gets cleared on sign out.

I am wondering if anyone else bypassing the Hosted UI has seen this behavior, or if there is some specific, high-level Amplify configuration I may have made a mistake with?

  • You haven't made any mistakes. This question explains what's going on: https://stackoverflow.com/questions/58154256/aws-cognito-how-to-force-select-account-when-signing-in-with-google/59580105 – teddybeard Feb 09 '20 at 22:40
  • 1
    @teddybeard Thanks for replying. I did find a solution to my particular issue, which was to upgrade `aws-amplify-react` from version 2.3.10 to version 3.1.5. With this upgrade, if a user is signed out from their Google account, my app seeks re-authentication/account selection every single time. – Leonard Soaivan Feb 11 '20 at 14:30

0 Answers0