Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OAuthNotConfigureException: oauth param not configured #14107

Open
3 tasks done
izner32 opened this issue Jan 2, 2025 · 6 comments
Open
3 tasks done

OAuthNotConfigureException: oauth param not configured #14107

izner32 opened this issue Jan 2, 2025 · 6 comments
Assignees
Labels
Auth Related to Auth components/category question General question

Comments

@izner32
Copy link

izner32 commented Jan 2, 2025

Before opening, please confirm:

JavaScript Framework

React Native

Amplify APIs

Authentication

Amplify Version

v6

Amplify Categories

auth

Backend

Amplify CLI

Environment information

System:
    OS: Windows 11 10.0.22631
    CPU: (12) x64 11th Gen Intel(R) Core(TM) i5-11400H @ 2.70GHz
    Memory: 16.82 GB / 39.73 GB
  Binaries:
    Node: 18.17.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 2.15.12 - ~\Desktop\Renz\Programming\Projects\random-chat-app-repos\meant\node_modules\.bin\npm.CMD
  Browsers:
    Edge: Chromium (127.0.2651.74)
    Internet Explorer: 11.0.22621.3527
  npmPackages:
    @aws-amplify/auth: ^6.0.12 => 6.3.0
    @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/datastore-storage-adapter: ^2.0.40 => 2.1.32       
    @aws-amplify/react-native: ^1.0.28 => 1.1.0
    @aws-amplify/rtn-web-browser: ^1.1.1 => 1.1.1
    @aws-sdk/client-gamelift: ^3.556.0 => 3.572.0
    @aws-sdk/client-s3: ^3.685.0 => 3.685.0
    @aws-sdk/s3-presigned-post: ^3.685.0 => 3.685.0
    @azure/core-asynciterator-polyfill: ^1.0.2 => 1.0.2
    @babel/core: ^7.24.0 => 7.24.5
    @expo/vector-icons: ^13.0.0 => 13.0.0
    @gorhom/bottom-sheet: ^4.6.4 => 4.6.4
    @miblanchard/react-native-slider: ^2.6.0 => 2.6.0
    @ptomasroos/react-native-multi-slider: ^2.2.2 => 2.2.2
    @react-native-async-storage/async-storage: 1.18.2 => 1.18.2     
    @react-native-community/datetimepicker: 7.2.0 => 7.2.0
    @react-native-community/netinfo: ^9.3.10 => 9.3.10
    @react-native-community/slider: ^4.5.2 => 4.5.2
    @react-native-picker/picker: 2.4.10 => 2.4.10
    @react-navigation/native: ^6.0.2 => 6.1.17
    @shopify/flash-list: 1.4.3 => 1.4.3
    @shopify/react-native-skia: 0.1.196 => 0.1.196
    @types/react: ~18.2.79 => 18.2.79
    @zamplyy/react-native-nice-avatar: ^1.1.2 => 1.1.2
    HelloWorld:  0.0.1
    aws-amplify: ^6.0.27 => 6.3.0
    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/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-plugin-module-resolver: ^5.0.0 => 5.0.2
    benchmark-uuid:  undefined ()
    expo: ^49.0.3 => 49.0.3
    expo-blur: ~12.4.1 => 12.4.1
    expo-build-properties: ~0.8.3 => 0.8.3
    expo-clipboard: ^7.0.0 => 7.0.0
    expo-file-system: ~15.4.5 => 15.4.5
    expo-font: ~11.4.0 => 11.4.0
    expo-haptics: ~12.4.0 => 12.4.0
    expo-image: ~1.3.5 => 1.3.5
    expo-image-manipulator: ~11.3.0 => 11.3.0
    expo-image-picker: ~14.3.2 => 14.3.2
    expo-linear-gradient: ~12.3.0 => 12.3.0
    expo-linking: ~5.0.2 => 5.0.2
    expo-location: ^17.0.1 => 17.0.1
    expo-media-library: ~15.4.1 => 15.4.1
    expo-router: ^2.0.0 => 2.0.15
    expo-secure-store: ~12.3.1 => 12.3.1
    expo-splash-screen: ~0.20.5 => 0.20.5
    expo-sqlite: ~11.3.3 => 11.3.3
    expo-status-bar: ~1.6.0 => 1.6.0
    expo-system-ui: ~2.4.0 => 2.4.0
    expo-video: ^1.2.7 => 1.2.7
    expo-web-browser: ~12.3.2 => 12.3.2
    firebase: ^10.7.1 => 10.11.1
    firebase/analytics:  undefined ()
    firebase/app:  undefined ()
    firebase/app-check:  undefined ()
    firebase/auth:  undefined ()
    firebase/auth/cordova:  undefined ()
    firebase/auth/web-extension:  undefined ()
    firebase/compat:  undefined ()
    firebase/compat/analytics:  undefined ()
    firebase/compat/app:  undefined ()
    firebase/compat/app-check:  undefined ()
    firebase/compat/auth:  undefined ()
    firebase/compat/database:  undefined ()
    firebase/compat/firestore:  undefined ()
    firebase/compat/functions:  undefined ()
    firebase/compat/installations:  undefined ()
    firebase/compat/messaging:  undefined ()
    firebase/compat/performance:  undefined ()
    firebase/compat/remote-config:  undefined ()
    firebase/compat/storage:  undefined ()
    firebase/database:  undefined ()
    firebase/firestore:  undefined ()
    firebase/firestore/lite:  undefined ()
    firebase/functions:  undefined ()
    firebase/installations:  undefined ()
    firebase/messaging:  undefined ()
    firebase/messaging/sw:  undefined ()
    firebase/performance:  undefined ()
    firebase/remote-config:  undefined ()
    firebase/storage:  undefined ()
    jest: ^29.2.1 => 29.7.0
    jest-expo: ~49.0.0 => 49.0.0
    latest: ^0.2.0 => 0.2.0
    lodash: ^4.17.21 => 4.17.21 (4.17.4, 3.10.1)
    lottie-react-native: 5.1.6 => 5.1.6
    metro-react-native-babel-preset: ^0.77.0 => 0.77.0 (0.76.8)     
    moment: ^2.30.1 => 2.30.1
    moti: ^0.29.0 => 0.29.0
    nativewind: ^2.0.11 => 2.0.11
    pullstate: ^1.25.0 => 1.25.0
    react: 18.2.0 => 18.2.0
    react-dom: 18.2.0 => 18.2.0 (16.14.0)
    react-native: 0.72.10 => 0.72.10
    react-native-animatable: ^1.4.0 => 1.4.0 (1.3.3)
    react-native-animated-pagination-dots: ^0.1.43 => 0.1.73        
    react-native-compressor: ^1.9.0 => 1.9.0
    react-native-context-menu-view: ^1.16.0 => 1.16.0
    react-native-countdown-circle-timer: ^3.2.1 => 3.2.1
    react-native-deck-swiper: ^2.0.16 => 2.0.17
    react-native-drag-sort: ^2.4.4 => 2.4.4
    react-native-element-dropdown: ^2.12.1 => 2.12.1
    react-native-flash-message: ^0.4.2 => 0.4.2
    react-native-gesture-handler: ~2.12.0 => 2.12.1
    react-native-get-random-values: ~1.9.0 => 1.9.0
    react-native-international-phone-number: ^0.7.5 => 0.7.6        
    react-native-modal: ^13.0.1 => 13.0.1
    react-native-modalfy: ^3.5.3 => 3.5.3
    react-native-pager-view: 6.2.0 => 6.2.0
    react-native-phone-number-input: ^2.1.0 => 2.1.0
    react-native-progress: ^5.0.1 => 5.0.1
    react-native-reanimated: ^3.3.0 => 3.3.0
    react-native-recaptcha-that-works: ^2.0.0 => 2.0.0
    react-native-redash: ^18.1.3 => 18.1.3 (12.6.1)
    react-native-safe-area-context: 4.6.3 => 4.6.3
    react-native-screens: ~3.22.0 => 3.22.1
    react-native-shadow-2: ^7.0.8 => 7.0.8
    react-native-sqlite-storage: ^6.0.1 => 6.0.1
    react-native-svg: 13.9.0 => 13.9.0
    react-native-ui-lib: ^7.20.3 => 7.21.2
    react-native-url-polyfill: ^2.0.0 => 2.0.0
    react-native-video: ^6.7.0 => 6.7.0
    react-native-virtualized-view: ^1.0.0 => 1.0.0
    react-native-web: ~0.19.10 => 0.19.11 (0.9.13)
    react-native-webview: 13.2.2 => 13.2.2
    react-native-wheel-pick: ^1.2.0 => 1.2.2
    react-test-renderer: 18.2.0 => 18.2.0
    tailwindcss: 3.3.2 => 3.3.2
    typescript: ^5.1.3 => 5.4.5
    uilib-native:  4.1.3
    uuid: ^11.0.3 => 11.0.3 (9.0.1, 8.3.2, 3.1.0, 2.0.3, 3.4.0, 7.0.3)
    web-streams-polyfill: ^4.0.0 => 4.0.0
    zustand: ^4.5.2 => 4.5.2
  npmGlobalPackages:
    @aws-amplify/cli: 12.10.1
    eas-cli: 9.0.0
    expo-cli: 6.3.10
    nextui-cli: 0.2.1
    node: 18.17.0
    nodemon: 2.0.22
    npm: 9.8.1
    wscat: 5.2.0


Describe the bug

I'm encountering an issue while trying to implement Google Sign-In using AWS Amplify in my Expo Go app. When I use await signInWithRedirect({ provider: 'Google' }), I get the following error: [OAuthNotConfigureException: oauth param not configured.]

Here’s what my amplifyconfiguration.json looks like:

{
  "aws_project_region": "us-east-1",
  "aws_cognito_identity_pool_id": "{hidden}",
  "aws_cognito_region": "us-east-1",
  "aws_user_pools_id": "{hidden}",
  "aws_user_pools_web_client_id": "{hidden}",
  "oauth": {
    "domain": "us-east-1{hidden}.auth.us-east-1.amazoncognito.com"
  },
  "federationTarget": "COGNITO_IDENTITY_POOLS",
  "aws_cognito_username_attributes": [
    "EMAIL"
  ],
  "aws_cognito_social_providers": [
    "GOOGLE"
  ],
  "aws_cognito_signup_attributes": [],
  "aws_cognito_mfa_configuration": "OFF",
  "aws_cognito_mfa_types": [],
  "aws_cognito_password_protection_settings": {
    "passwordPolicyMinLength": 8,
    "passwordPolicyCharacters": [
      "REQUIRES_LOWERCASE",
      "REQUIRES_UPPERCASE",
      "REQUIRES_NUMBERS",
      "REQUIRES_SYMBOLS"
    ]
  },
  "aws_cognito_verification_mechanisms": [
    "EMAIL",
    "PHONE_NUMBER"
  ]
}

Expected behavior

After following everything from https://docs.amplify.aws/gen1/react-native/build-a-backend/auth/add-social-provider/ I expect the Hosted UI to show up.

Reproduction steps

Do every step here: https://docs.amplify.aws/gen1/react-native/build-a-backend/auth/add-social-provider/

  1. Set-up social auth provider (Google)

  2. Set-up Cognito on AWS Console

    • User Pool
      • Application Type: Single-Page Application (SPA)
      • Options for sign-in identifiers: Email and Phone Number
      • Required Attributes: None
    • App Client
      • Identity Providers: Cognito User Pool and Google
      • OAuth 2.0 Grant Types: Authorization Code Grant and Implicit Grant
      • Authentication Flows: Only ALLOW_CUSTOM_AUTH
      • OpenID Connect Scopes: Email, OpenID, Phone
    • Federated Identity Provider Sign-in
      • Google
        • Authorized Scopes: profile email openid
        • Attribute Mapping: email (email) and username (sub)
    • Identity Pool
      • User Access: Authenticated Access and Guest Access
      • Authenticated Identity Sources: Amazon Cognito User Pool and Google

    Other else are using the default values.

  3. Configure Auth Category

    • amplify import auth
      • Cognito User Pool and Identity Pool
    • amplify push
  4. Going back to Google Developer Console (console.cloud.google.com) -> APIs & Services -> Credentials

    • Add corresponding domains to Authorized Javascript Origins and Authorized Redirect URIs
  5. Installed npm install @aws-amplify/rtn-web-browser

  6. Run the app in Expo Go

Code Snippet

// Put your code below this line.

Log output

// Put your logs below this line


aws-exports.js

/* eslint-disable */
// WARNING: DO NOT EDIT. This file is automatically generated by AWS Amplify. It will be overwritten.

const awsmobile = {
    "aws_project_region": "us-east-1",
    "aws_cognito_identity_pool_id": "{hidden}",
    "aws_cognito_region": "us-east-1",
    "aws_user_pools_id": "{hidden}",
    "aws_user_pools_web_client_id": "{hidden}",
    "oauth": {
        "domain": "us-east-1{hidden}.auth.us-east-1.amazoncognito.com"
    },
    "federationTarget": "COGNITO_IDENTITY_POOLS",
    "aws_cognito_username_attributes": [
        "EMAIL"
    ],
    "aws_cognito_social_providers": [
        "GOOGLE"
    ],
    "aws_cognito_signup_attributes": [],
    "aws_cognito_mfa_configuration": "OFF",
    "aws_cognito_mfa_types": [],
    "aws_cognito_password_protection_settings": {
        "passwordPolicyMinLength": 8,
        "passwordPolicyCharacters": [
            "REQUIRES_LOWERCASE",
            "REQUIRES_UPPERCASE",
            "REQUIRES_NUMBERS",
            "REQUIRES_SYMBOLS"
        ]
    },
    "aws_cognito_verification_mechanisms": [
        "EMAIL",
        "PHONE_NUMBER"
    ]
};


export default awsmobile;

Manual configuration

No response

Additional configuration

No response

Mobile Device

iPhone X

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

No response

@github-actions github-actions bot added pending-triage Issue is pending triage pending-maintainer-response Issue is pending a response from the Amplify team. labels Jan 2, 2025
@izner32
Copy link
Author

izner32 commented Jan 2, 2025

Adding the following to amplifyconfiguration.json

"oauth": {
    "domain": "us-east-1{hidden}.auth.us-east-1.amazoncognito.com",
    "responseType": "code"
  },

changes the error to [InvalidAppSchemeException: A valid non-http app scheme was not found in the config.]

@HuiSF
Copy link
Member

HuiSF commented Jan 2, 2025

Hi @izner32 thanks for opening this issue.

Looking at the aws-exports.js you pasted, under oauth property, the following properties are missing: scope, redirectSignIn, redirectSignOut and responseType.

Are you manually modifying the configuration file? If so, and if you have configured the social provider correctly, please use Amplify CLI (from reading your post, I presume you are using Amplify CLI instead of Amplify Gen2) to regenerate the configuration file. You can do this by the following:

amplify pull

@HuiSF HuiSF added question General question Auth Related to Auth components/category labels Jan 2, 2025
@github-actions github-actions bot removed pending-maintainer-response Issue is pending a response from the Amplify team. pending-triage Issue is pending triage labels Jan 2, 2025
@izner32
Copy link
Author

izner32 commented Jan 3, 2025

Hello,

The amplifyconfiguration.json and aws-exports.js I had from the post was the one generated by Amplify and I did not modify anything.

I already did the amplify pull, but still nothing happened. I also did amplify remove auth -> amplify import auth -> amplify push, still the same amplifyconfigurations.json output.

Perhaps stuff aren't configured properly on Cognito hence scope, redirectSignIn, redirectSignOut and responseType are not getting generated.

For additional context, I have added the complete reproduction step.

@github-actions github-actions bot added the pending-maintainer-response Issue is pending a response from the Amplify team. label Jan 3, 2025
@HuiSF
Copy link
Member

HuiSF commented Jan 3, 2025

Thanks for the follow up @izner32

I attempted amplify import auth to import an pre-existing Cognito User Pool client with Social Provider configured, I couldn't reproduce this issue. After amplify import auth and amplify push, the CLI generated correct amplifyconfiguration.json with all required fields.

Since you mentioned in the reproduction steps that you were manually creating and configuring your Cognito User Pool client, I suspect something might've been missed there. Could you inspect the client settings in AWS Console to double check your configurations?

If there is not specific requirement for you to manually create the User Pool and client for just using Amplify, I recommend you to create the resource with amplify add auth, or if you are building something new, you can consider to start with the Amplify Gen2 experience for setting up social providers.

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending a response from the Amplify team. label Jan 3, 2025
@izner32
Copy link
Author

izner32 commented Jan 3, 2025

Okay, I made the config below appear by placing a dummy allowed sign-out URL in Cognito and then re-importing the auth. But now, a different error has appeared [InvalidAppSchemeException: A valid non-http app scheme was not found in the config.] I suspect this is related to Expo Go since it has problems with native libraries. Thank you @HuiSF. I will close the issue once I find a solution for InvalidAppSchemeException.

"oauth": {
    "domain": "us-east-1{hidden}.auth.us-east-1.amazoncognito.com",
    "scope": [
      "email",
      "openid",
      "phone"
    ],
    "redirectSignIn": "https://{hidden}.cloudfront.net",
    "redirectSignOut": "http://localhost:3000/",
    "responseType": "code"
  },

@github-actions github-actions bot added the pending-maintainer-response Issue is pending a response from the Amplify team. label Jan 3, 2025
@cwomack cwomack self-assigned this Jan 3, 2025
@HuiSF
Copy link
Member

HuiSF commented Jan 3, 2025

Hey @izner32 As the documentation states, Expo Go is not supported.

But the exception you mentioned in your last comment, was due to a native app scheme URL is missing from the redirect urls in your configuration. Within a react-native app, a http or https scheme URL is unusable.

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending a response from the Amplify team. label Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auth Related to Auth components/category question General question
Projects
None yet
Development

No branches or pull requests

3 participants