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

Cognito authentication with Google: no redirection to linux app

Open Romain-Guillot opened this issue 1 year ago • 4 comments

Description

When I set up Cognito authentication and run the application on Linux, the redirection does not redirect to the application when logging in with an external provider (Google): nothing happens, just a page with "Not Found"

(Note that it works as expected when running in web mode).

here the results from the repo step for running on linux :

  • open the default web brower (https://accounts.google.com/v3/signin/identifier?...)
  • when the Google login succeed, here the redirect url: http://localhost:3084/?code=xx-xx-xx-xx-xx&state=xx-xx
  • no redirection, the webpage display "Not found" (the request returns 404)
  • On the application, the button "Sign In with Google" does nothing
  • Closing the chrome tab/chrome app change nothing
  • No debug log

I provided a minimal example with the demo application from the doc (Gen2) Flutter / Get Started / Quickstart.

The documentation mentions "No specific platform configuration is required." Did I miss a configuration step?

  • OS: Linux Mint 21.2 5.15.0-79-generic
  • Browsers tested: Opera 101.0.4843.58 / Chrome 116.0.5845.96
  • Packages:
amplify_flutter: ^2.3.0
amplify_auth_cognito: ^2.3.0
amplify_authenticator: ^2.1.1

Categories

  • [ ] Analytics
  • [ ] API (REST)
  • [ ] API (GraphQL)
  • [X] Auth
  • [X] Authenticator
  • [ ] DataStore
  • [ ] Notifications (Push)
  • [ ] Storage

Steps to Reproduce

Repro steps demo

Steps:

  • flutter create amplify_linux_demo
  • cd amplify_linux_demo
  • npm create amplify@latest -y
  • flutter pub add amplify_flutter
  • flutter pub add amplify_auth_cognito
  • flutter pub add amplify_authenticator
  • remplace main.dart by https://docs.amplify.aws/flutter/start/quickstart/
  • rm -r amplify/data amplify/auth
  • replace amplify/backend.ts with the below snippet
  • npx ampx sandbox --outputs-format dart --outputs-out-dir lib
  • run:
    • web: flutter run -d chrome --web-port 3084
      • result: OK
    • linux: flutter run -d linux
      • result: KO
      • open the default web brower (https://accounts.google.com/v3/signin/identifier?...)
      • when the Google login succeed, here the redirect url: http://localhost:3084/?code=xx-xx-xx-xx-xx&state=xx-xx
      • no redirection, the webpage display "Not found" (the request returns 404)
      • On the application, the button "Sign In with Google" does nothing
      • Closing the chrome tab/chrome app change nothing
      • No debug log

Screenshots

No response

Platforms

  • [ ] iOS
  • [ ] Android
  • [ ] Web
  • [ ] macOS
  • [ ] Windows
  • [X] Linux

Flutter Version

3.22.3

Amplify Flutter Version

2.3.0

Deployment Method

Amplify CLI

Schema

No response

Romain-Guillot avatar Aug 03 '24 10:08 Romain-Guillot

Hi @Romain-Guillot, thank you for the detailed steps.

replace amplify/backend.ts with the below snippet

I might have missed it, but can you point me to the backend.ts file you reference here?

Besides that, I believe this information will be enough to attempt reproducing the problem. We will provide updates as we have them, thanks.

Equartey avatar Aug 05 '24 14:08 Equartey

I might have missed it, but can you point me to the backend.ts file you reference here?

It's the file created by npm create amplify@latest -y. Here is the file for my repro app: https://github.com/Romain-Guillot/amplify-cognito-linux-demo/blob/main/amplify/backend.ts. In my case, the backend is "nothing" as I use only existing AWS resources.

It's where I put my cognito informations (as it's recommended to not create the generated config file directly)

Romain-Guillot avatar Aug 05 '24 14:08 Romain-Guillot

@Romain-Guillot thank you for the response and providing this information. we will look into this issue and get back to you with any updates.

NikaHsn avatar Aug 19 '24 22:08 NikaHsn

Hi @Romain-Guillot, can you please ensure you've following the generic platform setup for Amplify Flutter, https://docs.amplify.aws/gen1/flutter/start/project-setup/platform-setup/#linux

Equartey avatar Oct 04 '24 15:10 Equartey