Skip to content

rtn-web-browser not clearing cache after failed sign up #14687

@martincalvert

Description

@martincalvert

Before opening, please confirm:

JavaScript Framework

React Native

Amplify APIs

Authentication

Amplify Version

v6

Amplify Categories

auth

Backend

CDK

Environment information

Details
  System:
    OS: macOS 15.7.3
    CPU: (14) arm64 Apple M4 Pro
    Memory: 2.69 GB / 48.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 23.7.0 - /opt/homebrew/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 11.6.3 - /opt/homebrew/bin/npm
    Watchman: 2025.07.21.00 - /opt/homebrew/bin/watchman
  Browsers:
    Edge: 140.0.3485.94
    Firefox: 144.0.2
    Safari: 18.6
  npmPackages:
    @aws-amplify/react-native: ^1.3.1 => 1.3.1
    @aws-amplify/rtn-web-browser: ~1.3.0 => 1.3.0
    @aws-amplify/ui-react-native: ^2.6.4 => 2.6.4
    @babel/core: ^7.25.2 => 7.28.5
    @expo/vector-icons: ^15.0.3 => 15.0.3
    @invertase/react-native-apple-authentication: ^2.4.1 => 2.5.0
    @react-native-async-storage/async-storage: 2.2.0 => 2.2.0
    @react-native-community/netinfo: ^11.4.1 => 11.4.1
    @react-native-firebase/app: ^23.4.0 => 23.7.0
    @react-native-firebase/messaging: ^23.4.0 => 23.7.0
    @react-native-google-signin/google-signin: ^15.0.0 => 15.0.0
    @react-native-vector-icons/material-design-icons: 12.3.0 => 12.3.0
    @react-navigation/bottom-tabs: ^7.3.10 => 7.9.0
    @react-navigation/elements: ^2.3.8 => 2.9.3
    @react-navigation/native: ^7.1.6 => 7.1.26
    @types/react: ~19.1.10 => 19.1.17
    RNAppleAuthExample:  0.0.1
    aws-amplify: ^6.15.9 => 6.15.9
    aws-amplify/adapter-core:  undefined ()
    aws-amplify/adapter-core/internals:  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/internals:  undefined ()
    aws-amplify/api/server:  undefined ()
    aws-amplify/auth:  undefined ()
    aws-amplify/auth/cognito:  undefined ()
    aws-amplify/auth/cognito/server:  undefined ()
    aws-amplify/auth/enable-oauth-listener:  undefined ()
    aws-amplify/auth/server:  undefined ()
    aws-amplify/data:  undefined ()
    aws-amplify/data/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 ()
    date-fns: 4.1.0 => 4.1.0
    eslint: ^9.25.0 => 9.39.2
    eslint-config-expo: ~10.0.0 => 10.0.0
    expo: ~54.0.0 => 54.0.30
    expo-application: ~7.0.8 => 7.0.8
    expo-blob: ^0.1.7 => 0.1.7
    expo-blur: ~15.0.8 => 15.0.8
    expo-build-properties: ~1.0.10 => 1.0.10
    expo-camera: ~17.0.10 => 17.0.10
    expo-constants: ~18.0.11 => 18.0.12
    expo-dev-client: ~6.0.20 => 6.0.20
    expo-device: ~8.0.10 => 8.0.10
    expo-font: ~14.0.10 => 14.0.10
    expo-haptics: ~15.0.8 => 15.0.8
    expo-image: ~3.0.11 => 3.0.11
    expo-image-picker: ~17.0.9 => 17.0.10
    expo-linking: ~8.0.10 => 8.0.11
    expo-router: ~6.0.17 => 6.0.21
    expo-splash-screen: ~31.0.12 => 31.0.13
    expo-status-bar: ~3.0.9 => 3.0.9
    expo-symbols: ~1.0.8 => 1.0.8
    expo-system-ui: ~6.0.9 => 6.0.9
    expo-updates: ~29.0.15 => 29.0.15
    expo-video: ~3.0.15 => 3.0.15
    expo-web-browser: ~15.0.10 => 15.0.10
    immer: 10.1.1 => 10.1.1 (9.0.6)
    react: 19.1.0 => 19.1.0 (19.2.0-canary-5252281c-20250408)
    react-dom: 19.1.0 => 19.1.0 (19.2.0-canary-5252281c-20250408)
    react-native: 0.81.5 => 0.81.5
    react-native-advanced-input-mask: ^1.4.5 => 1.4.6
    react-native-blob-util: ^0.24.5 => 0.24.5
    react-native-gesture-handler: ~2.28.0 => 2.28.0
    react-native-get-random-values: ^1.11.0 => 1.11.0
    react-native-image-viewing: ^0.2.2 => 0.2.2
    react-native-keyboard-controller: 1.18.5 => 1.18.5
    react-native-pager-view: 6.9.1 => 6.9.1
    react-native-paper: ^5.14.5 => 5.14.5
    react-native-reanimated: ~4.1.1 => 4.1.6
    react-native-safe-area-context: ^5.6.1 => 5.6.2
    react-native-screens: ~4.16.0 => 4.16.0
    react-native-url-polyfill: ^2.0.0 => 2.0.0 (3.0.0)
    react-native-web: ^0.21.0 => 0.21.2
    react-native-webview: 13.15.0 => 13.15.0
    react-native-worklets: 0.5.1 => 0.5.1
    typescript: ~5.9.2 => 5.9.3
    zustand: ^5.0.7 => 5.0.9
  npmGlobalPackages:
    aws-cdk: 2.1017.1
    corepack: 0.31.0
    eas-cli: 16.28.0
    heroui-cli: 1.2.3
    homebridge-dreo-db94: 1.0.0
    npm: 11.6.3
    yarn: 1.22.22

Describe the bug

When a user attempts to sign up using google sign in on an android device, if the email is signed up through a different provider and the PreSignUp lambda fails the request the user then can never use google sign in again, as each time its selected it sends along the user account from the first attempt.

Workarounds I have tried:

  • I have uninstalled the app
  • Cleared the app's data and cache
  • Cleared Chrome's cache
  • Called signOut({global: true})
  • Navigated in chrome to the host ui page and successfully signed in with the new account, then re-attempted in the app.

Expected behavior

When a PreSignUp lambda fails the cache of run-web-browser should be cleared completely.

Reproduction steps

  1. Setup cognito
  2. Create an account using either apple/fb/azure/userPass
  3. Create an account using google but with the same email as step 2
  4. Observe google sign in is now permanently broken

Code Snippet

  const socialSignIn = async (provider: SignInType) => {
    setLoading(true);
    setSigningIn(true);
    try {
      signInWithRedirect({ provider: provider });
    } catch (e) {
      AppLogger(`${e}`);
    }
  };

  useEffect(() => {
    Hub.listen("auth", async (data) => {
      AppLogger(`${data.payload}`);
      AppLogger(`${data.payload.event}`);
      switch (data.payload.event) {
        case "signedIn":
          if (signingIn) {
            await setUser(data.payload.data.userId);
          }
          break;
        case "signInWithRedirect":
          setLoading(false);
          break;
        case "signInWithRedirect_failure":
          AppLogger(`${data.payload.data.error?.message}`);
          if (
            JSON.stringify(data.payload.data).includes(
              "Email+is+already+being+used"
            )
          ) {
            setMessage(
              data.payload.data.error?.message ??
                "That email address is already in use from a different provider."
            );
          }
          setLoading(false);
          break;
      }
    });
  });

Log output

Details
01-26 07:38:37.802  8070 12416 I ReactNativeJS: android: PreSignUp failed with error Email is already being used.
01-26 07:38:37.803  8070 12416 I ReactNativeJS: android: [object Object]
01-26 07:38:37.803  8070 12416 I ReactNativeJS: android: signInWithRedirect_failure
01-26 07:38:37.803  8070 12416 I ReactNativeJS: android: PreSignUp failed with error Email is already being used.
01-26 07:38:37.803  8070 12416 I ReactNativeJS: android: [object Object]
01-26 07:38:37.803  8070 12416 I ReactNativeJS: android: signInWithRedirect_failure
01-26 07:38:37.803  8070 12416 I ReactNativeJS: android: PreSignUp failed with error Email is already being used.
01-26 07:38:37.804  8070 12416 I ReactNativeJS: android: [object Object]
01-26 07:38:37.804  8070 12416 I ReactNativeJS: android: signInWithRedirect_failure
01-26 07:38:37.804  8070 12416 I ReactNativeJS: android: PreSignUp failed with error Email is already being used.

aws-exports.js

No response

Manual configuration

No response

Additional configuration

No response

Mobile Device

Samsung A12

Mobile Operating System

Android 12

Mobile Browser

rtn-web-browser

Mobile Browser Version

No response

Additional information and screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    AuthRelated to Auth components/categoryfeature-requestRequest a new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions