amplify-js icon indicating copy to clipboard operation
amplify-js copied to clipboard

Canceling social sign in breaks `signInWithRedirect`

Open johndebord opened this issue 6 months ago • 3 comments

Before opening, please confirm:

JavaScript Framework

React

Amplify APIs

Authentication

Amplify Version

v6

Amplify Categories

auth

Backend

Amplify CLI

Environment information

# Put output below this line
i@user project % npx envinfo --system --binaries --browsers --npmPackages --duplicates --npmGlobalPackages

  System:
    OS: macOS 13.0
    CPU: (8) arm64 Apple M2
    Memory: 307.05 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 20.11.0 - ~/.nvm/versions/node/v20.11.0/bin/node
    npm: 10.2.4 - ~/.nvm/versions/node/v20.11.0/bin/npm
  Browsers:
    Chrome: 121.0.6167.139
    Safari: 16.1
  npmPackages:
    @aws-amplify/auth: ^6.0.7 => 6.0.7 
    @aws-amplify/auth/cognito:  undefined ()
    @aws-amplify/auth/cognito/server:  undefined ()
    @aws-amplify/auth/server:  undefined ()
    @aws-amplify/cli: ^12.8.2 => 12.8.2 
    aws-amplify: ^6.0.7 => 6.0.7 
    aws-amplify/adapter-core:  undefined ()
    aws-amplify/analytics:  undefined ()
    aws-amplify/analytics/kinesis:  undefined ()
    aws-amplify/analytics/kinesis-firehose:  undefined ()
    aws-amplify/analytics/personalize:  undefined ()
    aws-amplify/analytics/pinpoint:  undefined ()
    aws-amplify/api:  undefined ()
    aws-amplify/api/server:  undefined ()
    aws-amplify/auth:  undefined ()
    aws-amplify/auth/cognito:  undefined ()
    aws-amplify/auth/cognito/server:  undefined ()
    aws-amplify/auth/server:  undefined ()
    aws-amplify/datastore:  undefined ()
    aws-amplify/in-app-messaging:  undefined ()
    aws-amplify/in-app-messaging/pinpoint:  undefined ()
    aws-amplify/push-notifications:  undefined ()
    aws-amplify/push-notifications/pinpoint:  undefined ()
    aws-amplify/storage:  undefined ()
    aws-amplify/storage/s3:  undefined ()
    aws-amplify/storage/s3/server:  undefined ()
    aws-amplify/storage/server:  undefined ()
    aws-amplify/utils:  undefined ()
    react: ^18.2.0 => 18.2.0 
  npmGlobalPackages:
    corepack: 0.23.0
    npm: 10.2.4
    react-native: 0.73.3

i@user project % 

Describe the bug

Calling signInWithRedirect again, after a prior cancelation, causes signInWithRedirect to not work; it does nothing. References: https://github.com/aws-amplify/amplify-ui/issues/4975, https://github.com/aws-amplify/amplify-ui/pull/4978

Expected behavior

Calling signInWithRedirect again, after a prior cancelation, should work.

Reproduction steps

// • Click the button
// • Cancel the sign in attempt
// • Click the button again
// • `signInWithRedirect` doesn't work because of the prior cancelation
import { signInWithRedirect } from "@aws-amplify/auth";
import { Amplify } from "aws-amplify";
import React from "react";
import ReactDOM from "react-dom/client";
import awsmobile from "./aws-exports";
Amplify.configure(awsmobile);
const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
  <button
    onClick={async () => {
      await signInWithRedirect({
        provider: "Google",
      });
    }}
    type="button"
  >
    Log In With Google
  </button>,
);

johndebord avatar Feb 07 '24 00:02 johndebord

Hi @johndebord thank you for opening this issue. It looks like you are using an older patch version of aws-amplify (6.0.7) that contains this issue. Can you try update to the latest version (6.0.15) and confirm if this issue still persist?

nadetastic avatar Feb 07 '24 14:02 nadetastic

Hi @johndebord following up here - are you still facing this issue or were you able to get this resolved?

nadetastic avatar Feb 12 '24 16:02 nadetastic

I upgraded to version 6.0.15 and can confirm that it is now working/resolved. @nadetastic thanks for the help.

johndebord avatar Feb 14 '24 06:02 johndebord

This issue seems to occur again with 6.0.23, 6.0.15 appears to work fine though.

dawidvdh avatar Mar 28 '24 11:03 dawidvdh

@nadetastic Has this bug regressed?

I encounter the bug on Chrome and Safari with Authenticator on latest: "aws-amplify": "^6.0.26", "@aws-amplify/ui-react": "^6.1.6",

alex-breen avatar Apr 06 '24 22:04 alex-breen