Skip to content

signInWithRedirect causes "Required parameters missing" error with Cognito #14653

@delta1513

Description

@delta1513

Before opening, please confirm:

JavaScript Framework

React Native

Amplify APIs

Authentication

Amplify Version

v6

Amplify Categories

auth

Backend

None

Environment information

Details
  System:
    OS: macOS 26.1
    CPU: (8) arm64 Apple M1
    Memory: 110.14 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.11.0
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 11.6.1
    pnpm: 10.11.0 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 143.0.7499.110
    Firefox: 145.0.2
    Safari: 26.1
  npmPackages:
    @aws-amplify/react-native: 1.1.10 => 1.1.10
    @aws-amplify/rtn-web-browser: 1.1.4 => 1.1.4
    @babel/core: ^7.20.12 => 7.28.4
    @babel/plugin-proposal-private-methods: ^7.18.6 => 7.18.6
    @babel/preset-env: ^7.20.2 => 7.28.3
    @babel/runtime: ^7.27.0 => 7.28.4
    @eslint/compat: ^1.3.1 => 1.4.0
    @expo/react-native-action-sheet: 4.0.1 => 4.0.1
    @faker-js/faker: ^7.6.0 => 7.6.0 (8.0.1)
    @hookform/resolvers: 2.9.11 => 2.9.11 (3.1.0)
    @hookform/resolvers/ajv:  1.0.0
    @hookform/resolvers/arktype:  undefined (1.0.0)
    @hookform/resolvers/class-validator:  1.0.0
    @hookform/resolvers/computed-types:  1.0.0
    @hookform/resolvers/io-ts:  1.0.0
    @hookform/resolvers/joi:  1.0.0
    @hookform/resolvers/nope:  1.0.0
    @hookform/resolvers/superstruct:  1.0.0
    @hookform/resolvers/typanion:  1.0.0
    @hookform/resolvers/typebox:  undefined (1.0.0)
    @hookform/resolvers/vest:  1.0.0
    @hookform/resolvers/yup:  1.0.0
    @hookform/resolvers/zod:  1.0.0
    @launchdarkly/react-native-client-sdk: ^10.11.0 => 10.11.0
    @react-native-async-storage/async-storage: 2.2.0 => 2.2.0
    @react-native-clipboard/clipboard: ^1.14.0 => 1.16.3
    @react-native-community/netinfo: 11.4.1 => 11.4.1
    @react-native-masked-view/masked-view: ^0.3.1 => 0.3.2
    @react-native/babel-preset: 0.82.1 => 0.82.1 (0.75.5)
    @react-native/eslint-config: 0.80.2 => 0.80.2
    @react-native/eslint-plugin: ^0.80.0 => 0.80.2
    @react-native/metro-config: 0.75.5 => 0.75.5
    @react-native/typescript-config: 0.82.1 => 0.82.1
    @reduxjs/toolkit: ^1.9.2 => 1.9.7
    @reduxjs/toolkit-query:  1.0.0
    @reduxjs/toolkit-query-react:  1.0.0
    @segment/analytics-react-native: 1.5.3 => 1.5.3
    @sentry/react-native: 6.10.0 => 6.10.0
    @testing-library/jest-native: 5.4.3 => 5.4.3
    @testing-library/react-native: 12.1.2 => 12.1.2
    @tsconfig/react-native: ^3.0.0 => 3.0.7
    @types/intl: 1.2.0 => 1.2.0
    @types/jest: 29.5.14 => 29.5.14
    @types/lodash: 4.14.191 => 4.14.191
    @types/metro-config: ^0.76.3 => 0.76.3
    @types/react: ^18.2.6 => 18.3.26 (17.0.89)
    @types/react-native-dotenv: ^0.2.0 => 0.2.2
    @types/react-native-vector-icons: 6.4.13 => 6.4.13
    @types/react-redux: 7.1.25 => 7.1.25
    @types/react-router-native: ^5.1.3 => 5.1.3
    @types/react-test-renderer: ^18.0.0 => 18.3.1
    @types/redux-immutable-state-invariant: 2.1.2 => 2.1.2
    @types/redux-logger: 3.0.13 => 3.0.13
    @types/semver: 7.7.0 => 7.7.0 (7.7.1)
    @types/sinon: 9.0.8 => 9.0.8
    @types/styled-components: ^5.1.26 => 5.1.34
    @types/styled-components-react-native: ^5.2.1 => 5.2.5
    aws-amplify: 6.15.5 => 6.15.5
    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 ()
    babel-jest: ^29.6.3 => 29.7.0
    customerio-reactnative: 3.6.0 => 3.6.0
    es-toolkit: ^1.39.10 => 1.40.0
    eslint: 9.28.0 => 9.28.0
    eslint-import-resolver-typescript: ^4.4.3 => 4.4.4
    eslint-plugin-import: ^2.27.5 => 2.32.0
    eslint-plugin-jest: ^27.2.1 => 27.9.0
    eslint-plugin-prettier: 5.2.5 => 5.2.5
    eslint-plugin-react: ^7.37.5 => 7.37.5
    eslint-plugin-react-hooks: ^5.2.0 => 5.2.0
    eslint-plugin-react-native: ^5.0.0 => 5.0.0 (4.1.0)
    example:  1.0.0
    husky: 3.1.0 => 3.1.0
    integration_tests_auth_server:  1.0.0
    intl: 1.2.5 => 1.2.5
    jest: ^29.6.3 => 29.7.0
    jest-watch-typeahead: 2.2.2 => 2.2.2
    knip: ^5.62.0 => 5.64.2
    lint-staged: ^16.2.3 => 16.2.3
    moment: 2.30.1 => 2.30.1
    moment-timezone: 0.5.40 => 0.5.40 (0.5.43)
    patch-package: ^8.0.0 => 8.0.1
    postinstall-postinstall: ^2.1.0 => 2.1.0
    prettier: 3.5.3 => 3.5.3
    pretty-quick: 4.1.1 => 4.1.1
    pusher-js: 8.4.0 => 8.4.0
    query-string: 9.1.2 => 9.1.2 (8.1.0)
    react: 18.3.1 => 18.3.1
    react-hook-form: 7.55.0 => 7.55.0 (7.43.9)
    react-native: 0.75.5 => 0.75.5
    react-native-blob-util: ^0.21.2 => 0.21.3
    react-native-date-picker: 4.2.8 => 4.2.8
    react-native-default-preference: ^1.4.4 => 1.4.4
    react-native-device-info: 10.4.0 => 10.4.0
    react-native-document-picker: 9.3.1 => 9.3.1
    react-native-dotenv: 3.4.11 => 3.4.11
    react-native-fs: 2.20.0 => 2.20.0
    react-native-gesture-handler: 2.24.0 => 2.24.0
    react-native-get-random-values: 1.11.0 => 1.11.0
    react-native-image-picker: 7.1.2 => 7.1.2
    react-native-inappbrowser-reborn: 3.7.0 => 3.7.0
    react-native-keyboard-aware-scroll-view: 0.9.5 => 0.9.5
    react-native-linear-gradient: ^2.8.3 => 2.8.3
    react-native-modal: 13.0.1 => 13.0.1
    react-native-modalfy: 3.4.0 => 3.4.0
    react-native-pdf: 6.7.7 => 6.7.7
    react-native-permissions: 3.6.1 => 3.6.1
    react-native-reanimated: 3.17.2 => 3.17.2
    react-native-reanimated-carousel: 4.0.3 => 4.0.3
    react-native-safe-area-context: 5.6.0 => 5.6.0
    react-native-send-intent: 1.3.0 => 1.3.0
    react-native-shadow-2: ^7.0.8 => 7.1.2
    react-native-splash-screen: 3.3.0 => 3.3.0
    react-native-svg: 15.11.2 => 15.11.2
    react-native-url-polyfill: ^3.0.0 => 3.0.0 (2.0.0)
    react-native-vector-icons: 9.2.0 => 9.2.0
    react-redux: 8.0.5 => 8.0.5
    react-router-native: 5.3.4 => 5.3.4
    react-test-renderer: 18.3.1 => 18.3.1
    react-zlib-js: 1.0.5 => 1.0.5
    redux-immutable-state-invariant: 2.1.0 => 2.1.0
    redux-logger: 3.0.6 => 3.0.6
    redux-thunk: 3.1.0 => 3.1.0 (2.4.2)
    semver: 7.7.1 => 7.7.1 (6.3.1, 7.7.3, 5.7.2)
    sinon: 9.2.0 => 9.2.0
    sockjs-client:  0.0.0-unreleasable
    styled-components: 5.3.6 => 5.3.6
    styled-components/macro:  undefined ()
    styled-components/native:  undefined ()
    styled-components/primitives:  undefined ()
    typescript: 5.8.3 => 5.8.3
    typescript-eslint: ^8.35.0 => 8.46.0
    yup: ^1.0.0 => 1.7.1 (1.6.1)
  npmGlobalPackages:
    corepack: 0.34.0
    npm: 11.6.1

Describe the bug

The redirect URL for signInWithRedirect has incorrect formatting in the query string which I believe might be causing Cognito to throw an error when it attempts to parse it.

Here's an obfuscated URL that I was able to capture after I ran signInWithRedirect on our mobile app on android:

https://REDACTED.auth.ap-southeast-2.amazoncognito.com/oauth2/authorize?0=redirect_uri%2CREDACTED%3A%2F%2Foauth&1=response_type%2Ccode&2=client_id%2CREDACTED&identity_provider=REDACTED-GSuite&scope=openid%20email%20phone%20profile&prompt=select_account&state=REDACTED&code_challenge=REDACTED&code_challenge_method=REDACTED

Notice how the first few URL parameters are defined by an index followed by a comma-separated list of values?

I don't know much about what Cognito requires, but I am assuming that these tuples have caused one of the parameters that Cognito needs to instead be stored in one of those indexes as a key, and as a result, it can't find it so it redirects me to a page that looks like this:

Image

And has the following URL: https://REDACTED.auth.ap-southeast-2.amazoncognito.com/error?error=Required+parameters+missing

I can tell that these URL parameters are the issue, because if I re-arrange them to how I think they should be, the link works perfectly fine.

Expected behavior

I should be redirected to a URL that looks like this:

https://REDACTED.auth.ap-southeast-2.amazoncognito.com/oauth2/authorize?redirect_uri=CREDACTED%3A%2F%2Foauth&response_type=code&client_id=REDACTED&identity_provider=REDACTED-GSuite&scope=openid%20email%20phone%20profile&prompt=select_account&state=REDACTED&code_challenge=REDACTED&code_challenge_method=REDACTED

Reproduction steps

(See code snippet)

I have only tested using Android so far.

Code Snippet

await signInWithRedirect({
      provider: {
        custom: 'myprovider',
      },
      options: {
        prompt: 'SELECT_ACCOUNT',
      },
    });

Log output

Details
// Put your logs below this line


aws-exports.js

No response

Manual configuration

No response

Additional configuration

No response

Mobile Device

Android Emulator

Mobile Operating System

Android 15

Mobile Browser

Chrome

Mobile Browser Version

N/A

Additional information and screenshots

I experienced this issue after upgrading to the latest version of AWS amplify. It's possible that the fixes from this issue might be related: #14513

Metadata

Metadata

Assignees

No one assigned

    Labels

    AuthRelated to Auth components/categorybugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions