aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.42k stars 2.12k forks source link

Google SSO when signing in with username and password fails #7737

Closed ds8k closed 3 years ago

ds8k commented 3 years ago

Describe the bug If a user has to provide their username/password on the Google Auth screen, upon returning to our app an error is triggered:

[Thu Feb 11 2021 17:52:55.879] LOG [ValidationException: 1 validation error detected: Value '{cognito-idp.us-east-1.amazonaws.com/***' at 'logins' failed to satisfy constraint: Map value must satisfy constraint: [Member must have length less than or equal to 50000, Member must have length greater than or equal to 1]]

If I'm already signed into my account in the browser, signing in works fine.

amhinson commented 3 years ago

Hey @ds8k 👋 Would you be able to provide some more context on this issue you're facing? What are the reproduction steps to get to this error? Also, could you post your package.json?

ds8k commented 3 years ago

Sure!

package.json

% npx envinfo --system --binaries --browsers --npmPackages --npmGlobalPackages
  System:
    OS: macOS 11.2
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 439.29 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.15.1 - ~/.nvm/versions/node/v14.15.1/bin/node
    Yarn: 1.22.5 - ~/.yarn/bin/yarn
    npm: 6.14.8 - ~/.nvm/versions/node/v14.15.1/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Browsers:
    Chrome: 88.0.4324.150
    Firefox: 85.0.1
    Safari: 14.0.3
  npmPackages:
    @apollo/react-hooks: ^3.0.1 => 3.0.1 
    @apollo/react-testing: ^3.0.1 => 3.0.1 
    @aws-amplify/auth: 3.4.20 => 3.4.20 
    @aws-amplify/core: 3.8.12 => 3.8.12 
    @babel/core: ^7.10.2 => 7.10.2 
    @babel/plugin-proposal-decorators: ^7.12.1 => 7.12.1 
    @babel/runtime: ^7.10.2 => 7.10.2 
    @callosum/react-native-google-ad-manager: 2.0.2 => 2.0.2 
    @react-native-community/async-storage: ^1.12.1 => 1.12.1 
    @react-native-community/clipboard: ^1.4.0 => 1.4.0 
    @react-native-community/eslint-config: ^2.0.0 => 2.0.0 
    @react-native-community/netinfo: ^5.3.3 => 5.3.3 
    @react-native-community/push-notification-ios: ^1.2.0 => 1.2.0 
    @react-native-firebase/analytics: 7.6.1 => 7.6.1 
    @react-native-firebase/app: ^8.4.1 => 8.4.1 
    @react-native-firebase/crashlytics: 8.4.2 => 8.4.2 
    @react-native-firebase/dynamic-links: 7.5.2 => 7.5.2 
    @react-native-firebase/iid: 7.4.2 => 7.4.2 
    @react-native-firebase/messaging: 7.8.3 => 7.8.3 
    @react-native-picker/picker: ^1.9.2 => 1.9.2 
    @sentry/cli: 1.62.0 => 1.62.0 
    @sentry/react-native: ^2.2.0 => 2.2.0 
    @testing-library/jest-native: ^3.1.0 => 3.1.0 
    @types/detox: ^14.5.2 => 14.5.2 
    @types/i18n-js: ^3.0.1 => 3.0.1 
    @types/jasmine: ^3.5.1 => 3.5.8 
    @types/jest: ^25.2.3 => 25.2.3 
    @types/react: ^17.0.0 => 17.0.0 
    @types/react-native: ^0.63.41 => 0.63.41 
    @types/react-test-renderer: ^16.9.1 => 16.9.1 
    @types/styled-components: ^4.1.19 => 4.1.19 
    @typescript-eslint/eslint-plugin: ^4.10.0 => 4.10.0 
    @typescript-eslint/parser: ^4.10.0 => 4.10.0 
    amazon-cognito-identity-js: 4.5.10 => 4.5.10 
    apollo-cache-inmemory: ^1.6.3 => 1.6.3 
    apollo-cache-persist: ^0.1.1 => 0.1.1 
    apollo-client: ^2.6.8 => 2.6.8 
    apollo-link-context: ^1.0.20 => 1.0.20 
    apollo-link-error: ^1.1.12 => 1.1.12 
    apollo-link-http: ^1.5.16 => 1.5.16 
    apollo-link-persisted-queries: ^0.2.2 => 0.2.2 
    apollo-utilities: ^1.3.2 => 1.3.2 
    async: ^3.2.0 => 3.2.0 
    aws-amplify-react-native: 4.3.1 => 4.3.1 
    babel-jest: ^25.1.0 => 25.5.1 
    base-64: ^0.1.0 => 0.1.0 
    bluebird: ^3.7.2 => 3.7.2 
    date-fns: ^2.0.0-beta.4 => 2.0.1 
    detox: 17.8.3 => 17.8.3 
    eslint: ^7.15.0 => 7.15.0 
    eslint-config-prettier: ^7.0.0 => 7.0.0 
    eslint-plugin-prettier: ^3.3.0 => 3.3.0 
    eslint-plugin-react: ^7.21.5 => 7.21.5 
    eslint-plugin-react-hooks: ^4.2.0 => 4.2.0 
    eventemitter3: ^4.0.0 => 4.0.0 
    fs-extra: ^8.1.0 => 8.1.0 
    graphql: ^14.5.4 => 14.5.4 
    graphql-tag: ^2.10.1 => 2.10.1 
    hermes-engine: 0.5.2-rc1 => 0.5.2-rc1 
    i18n-js: ^3.3.0 => 3.3.0 
    jest: ^26.0.1 => 26.0.1 
    jest-junit: ^10.0.0 => 10.0.0 
    md5: ^2.2.1 => 2.2.1 
    metro-react-native-babel-preset: ^0.59.0 => 0.59.0 
    mobx: ^6.0.1 => 6.0.1 
    mobx-react-lite: ^3.1.6 => 3.1.6 
    patch-package: ^6.2.2 => 6.2.2 
    postinstall-postinstall: ^2.1.0 => 2.1.0 
    prettier: ^2.2.1 => 2.2.1 
    react: 16.13.1 => 16.13.1 
    react-dom: ^17.0.1 => 17.0.1 
    react-native: 0.63.2 => 0.63.2 
    react-native-action-sheet: ^2.2.0 => 2.2.0 
    react-native-autoheight-webview: ^1.4.2 => 1.4.2 
    react-native-background-fetch: ^3.0.3 => 3.0.3 
    react-native-base64: ^0.1.0 => 0.1.0 
    react-native-branch: ^5.0.0 => 5.0.0 
    react-native-dark-mode: ^0.2.2 => 0.2.2 
    react-native-device-info: ^5.5.4 => 5.5.4 
    react-native-dialog: ^5.6.0 => 5.6.0 
    react-native-fast-image: ^8.1.5 => 8.1.5 
    react-native-gesture-handler: 1.9.0 => 1.9.0 
    react-native-hooks: ^0.9.0 => 0.9.0 
    react-native-htmlview: ^0.15.0 => 0.15.0 
    react-native-image-pan-zoom: 2.1.12 => 2.1.12 
    react-native-inappbrowser-reborn: ^3.3.4 => 3.3.4 
    react-native-jw-media-player: 0.1.47 => 0.1.47 
    react-native-music-control: ^0.12.0 => 0.12.0 
    react-native-orientation-locker: ^1.2.0 => 1.2.0 
    react-native-permissions: ^2.1.5 => 2.1.5 
    react-native-rate: ^1.2.1 => 1.2.1 
    react-native-reanimated: ^1.7.0 => 1.13.1 
    react-native-safe-area-context: ^1.0.2 => 1.0.2 
    react-native-safe-area-view: ^2.0.0 => 2.0.0 
    react-native-scalable-image: ^1.0.0 => 1.0.0 
    react-native-screens: 2.11.0 => 2.11.0 
    react-native-share: ^3.0.0 => 3.0.0 
    react-native-svg: ^12.1.0 => 12.1.0 
    react-native-svg-icon: ^0.8.1 => 0.8.1 
    react-native-testing-library: ^2.0.0 => 2.0.0 
    react-native-track-player: ^1.2.3 => 1.2.3 
    react-native-version-number: ^0.3.6 => 0.3.6 
    react-native-webview: ^9.0.1 => 9.0.1 
    react-native-widget-kit:  0.1.0 
    react-native-youtube-iframe: ^1.2.4 => 1.2.4 
    react-navigation: ^4.4.3 => 4.4.3 
    react-navigation-hooks: ^1.1.0 => 1.1.0 
    react-navigation-stack: ^1.10.3 => 1.10.3 
    react-navigation-tabs: ^2.10.1 => 2.10.1 
    react-test-renderer: 16.13.1 => 16.13.1 
    reanimated-bottom-sheet: ^1.0.0-alpha.22 => 1.0.0-alpha.22 
    redux-persist-filesystem-storage: ^2.2.0 => 2.2.0 
    rn-fetch-blob: ^0.12.0 => 0.12.0 
    scheduler: ^0.19.1 => 0.19.1 
    shortid: ^2.2.15 => 2.2.15 
    string.prototype.matchall: ^4.0.1 => 4.0.1 
    styled-components: ^5.2.0 => 5.2.0 
    ts-jest: ^26.1.0 => 26.1.0 
    typescript: ^4.1.3 => 4.1.3 
    unescape: ^1.0.1 => 1.0.1 
    url-parse: ^1.4.7 => 1.4.7 
  npmGlobalPackages:
    @aws-amplify/cli: 4.41.2
    ios-deploy: 1.11.3
    npm: 6.14.8
ds8k commented 3 years ago

@amhinson Found the source of my issues:

There's an additional / showing up in my redirect URL when returned from that specific google page:

--currentUrl-- com.***.dev.cognito:///?code=
--_handleCodeFlow-- parse(currentUrl).pathname /
--_handleCodeFlow-- parse(this._config.redirectSignIn).pathname null

Because the two pathnames don't match, this code in OAuth.ts is executed and my user is never signed in: https://github.com/aws-amplify/amplify-js/blob/286c9e8fbec3ccdc5bf24edf3cbfb2bae370d751/packages/auth/src/OAuth/OAuth.ts#L128-L130

Is this an issue with the SDK? Do I have an extra / somewhere in my config? I've poked around my AWS config and don't see any triple slashes.

EDIT: This looks to be a known issue - #7468 #7477 are describing the same behavior

wlee221 commented 3 years ago

Hi, we will keep track of this issue in #7468. Thanks!

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.