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

Flutter Web AmplifyAuthCognito SignOut not working #4747

Open
2 of 14 tasks
BerndWessels opened this issue Apr 19, 2024 · 7 comments
Open
2 of 14 tasks

Flutter Web AmplifyAuthCognito SignOut not working #4747

BerndWessels opened this issue Apr 19, 2024 · 7 comments
Assignees
Labels
auth Issues related to the Auth Category Investigating Issues that are assigned and are being looked into question A question about the Amplify Flutter libraries

Comments

@BerndWessels
Copy link

Description

Signing out with AmplifyAuthCognito signOut() does not sign out the current user.

Works fine on Android, but does not work on the web :(

Feels like the redirect happens before the tokens have been cleared by the plugin in the browser, but that's just a guess.

Categories

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

Steps to Reproduce

  • Build a simple Flutter Web App and add AmplifyAuthCognito
  • Use signInWithWebUI() to sign in
  • Use signOut() to sign out

User is not signed out, entries in index db are not deleted.

dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.6
  adaptive_theme: ^3.6.0
  flutter_native_splash: ^2.4.0
  flutter_launcher_icons: ^0.13.1
  get_it: ^7.6.7
  go_router: ^13.2.2
  signals: ^5.0.0
  amplify_api: ^1.7.0
  amplify_auth_cognito: ^1.7.0
  amplify_authenticator: ^1.5.4
  amplify_flutter: ^1.7.0
  shared_preferences: ^2.2.2
  loader_overlay: ^4.0.0
  responsive_framework: ^1.4.0
  graphql: ^5.2.0-beta.7

dev_dependencies:
  flutter_test:
    sdk: flutter
Flutter 3.19.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 300451adae (3 weeks ago) • 2024-03-27 21:54:07 -0500
Engine • revision e76c956498
Tools • Dart 3.3.3 • DevTools 2.31.1

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.19.5, on Microsoft Windows [Version 10.0.22631.3447], locale en-NZ)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web
[X] Visual Studio - develop Windows apps
    X Visual Studio not installed; this is necessary to develop Windows apps.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2023.2)
[√] VS Code (version 1.88.0)
[√] Connected device (4 available)
[√] Network resources

Screenshots

image

Platforms

  • iOS
  • Android
  • Web
  • macOS
  • Windows
  • Linux

Flutter Version

3.19.5

Amplify Flutter Version

1.7.0

Deployment Method

Amplify CLI

Schema

No response

@NikaHsn
Copy link
Contributor

NikaHsn commented Apr 19, 2024

@BerndWessels Thank you for reporting the issue. I've attempted to replicate the problem using the steps you provided, but I was unable to reproduce the issue. Please note that IndexedDB in the developer tools does not automatically refresh. After signing out, please manually refresh the IndexedDB view using the refresh button to check if the credential still exists. Additionally, could you provide the code snippets for the signIn and signOut functions?

@NikaHsn NikaHsn added auth Issues related to the Auth Category pending-response Issue is pending response from the issue requestor pending-triage This issue is in the backlog of issues to triage labels Apr 19, 2024
@BerndWessels
Copy link
Author

@NikaHsn Thanks for your response. Here is my project to reproduce the issue https://github.com/BerndWessels/amplify_auth_issue

Just edit the amplifyconfiguration_web.dart with your own values, then

  • run
  • sign in
  • onces signed in press the little face icon on the right in the app bar to sign out

when I sign out, it reloads the webpage but the user is not signed out :(

Hope this will let you reproduce the issue, thanks.

@khatruong2009 khatruong2009 removed the pending-response Issue is pending response from the issue requestor label Apr 25, 2024
@khatruong2009
Copy link
Contributor

Hi @BerndWessels, thank you for providing your project. We will take a look when we get the chance and get back to you with any updates.

@jamontesg
Copy link

jamontesg commented Apr 27, 2024

Same Error, on ANDROID

Runing Flutter on MacOs

Flutter (Channel stable, 3.19.6, on macOS 14.4.1 23E224 darwin-arm64, locale es-CO)
• Flutter version 3.19.6 on channel stable at /Users/jmontes/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 54e66469a9 (9 days ago), 2024-04-17 13:08:03 -0700
• Engine revision c4cd48e186
• Dart version 3.3.4
• DevTools version 2.31.1

Pubspec

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations: 
    sdk: flutter         # Add this line

  intl: ^0.18.1


  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2
  flutter_form_builder: ^9.0.0
  form_builder_validators: ^9.0.0
  form_builder_image_picker: ^4.0.0
  flutter_pw_validator: ^1.4.2
  sleek_circular_slider: ^2.0.1
  flutter_circular_text: ^0.3.1
  footer: ^0.0.4
  settings_ui: 2.0.2
  provider: ^6.0.5
  get_it: ^7.3.0
  get: ^4.6.5
  localization: ^2.1.0
  
  amplify_api: ^1.8.0
  amplify_api_dart: ^0.4.0
  amplify_auth_cognito: ^1.8.0
  amplify_authenticator: ^1.6.0
  amplify_analytics_pinpoint: ^1.8.0
  amplify_datastore: ^1.8.0
  amplify_datastore_plugin_interface: ^1.8.0
  amplify_flutter: ^1.8.0
  amplify_storage_s3: ^1.8.0
  aws_common: ^0.6.4

@Jordan-Nelson
Copy link
Contributor

@jamontesg can you provide reproduction steps and sample code?

@Jordan-Nelson Jordan-Nelson added pending-response Issue is pending response from the issue requestor and removed pending-response Issue is pending response from the issue requestor labels May 1, 2024
@jamontesg
Copy link

@Jordan-Nelson I don't have the problem anymore.
Thanks

@Jordan-Nelson
Copy link
Contributor

@jamontesg thanks for letting us know.

We will attempt to reproduce the original issue with the provided sample app.

@Jordan-Nelson Jordan-Nelson added question A question about the Amplify Flutter libraries and removed pending-triage This issue is in the backlog of issues to triage labels May 7, 2024
@Jordan-Nelson Jordan-Nelson self-assigned this May 7, 2024
@Jordan-Nelson Jordan-Nelson added the Investigating Issues that are assigned and are being looked into label May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth Issues related to the Auth Category Investigating Issues that are assigned and are being looked into question A question about the Amplify Flutter libraries
Projects
None yet
Development

No branches or pull requests

5 participants