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

signOut CognitoSignOutResult different behavior on iOS and Android #5402

Open
3 of 14 tasks
lokalathlet opened this issue Aug 31, 2024 · 10 comments
Open
3 of 14 tasks

signOut CognitoSignOutResult different behavior on iOS and Android #5402

lokalathlet opened this issue Aug 31, 2024 · 10 comments
Labels
auth Issues related to the Auth Category pending-community-response Pending response from the issue opener or other community members question A question about the Amplify Flutter libraries

Comments

@lokalathlet
Copy link

Description

The "signedOutLocally" result in airplane Mode is different on iOS (false) and Android (true).
My expectation is, that I can signOut successful on both environments -> "signedOutLocally": true

See the logs for iOS and Android:
iOS:
`┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────

    │ [debug] | 13:12:12 481ms | ::signOut result: CognitoSignOutResult {

    │   "exception": "NetworkException {\n  \"message\": \"The request failed due to a network error.\",\n  \"recoverySuggestion\": \"Ensure that you have an active network connection\",\n  \"underlyingException\": \"POST https://cognito-idp.eu-central-1.amazonaws.com/? failed: SocketException: Failed host lookup: 'cognito-idp.eu-central-1.amazonaws.com' (OS Error: nodename nor servname provided, or not known, errno = 8)\"\n}",

    │   "signedOutLocally": false

    │ }

    └──────────────────────────────────────────────────────────────────────────────────────────────────────────────

Android:
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────

I/flutter ( 4454): │ [debug] | 13:30:42 760ms | ::signOut result: CognitoSignOutResult {

I/flutter ( 4454): │ "hostedUiException": "HostedUiException {\n "message": "Failed to perform Hosted UI sign out",\n "recoverySuggestion": "See underlyingException for more details",\n "underlyingException": "PlatformException(CANCELLED, com.amazonaws.amplify.amplify_auth_cognito.HostedUiException$CANCELLED, Cause: null, Stacktrace: com.amazonaws.amplify.amplify_auth_cognito.HostedUiException$CANCELLED\n\tat com.amazonaws.amplify.amplify_auth_cognito.AmplifyAuthCognitoPlugin.cancelCurrentOperation(AmplifyAuthCognitoPlugin.kt:587)\n\tat com.amazonaws.amplify.amplify_auth_cognito.AmplifyAuthCognitoPlugin.onNewIntent(AmplifyAuthCognitoPlugin.kt:542)\n\tat io.flutter.embedding.engine.FlutterEngineConnectionRegistry$FlutterEngineActivityPluginBinding.onNewIntent(FlutterEngineConnectionRegistry.java:799)\n\tat io.flutter.embedding.engine.FlutterEngineConnectionRegistry.onNewIntent(FlutterEngineConnectionRegistry.java:437)\n\tat io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.on

I/flutter ( 4454): │ "globalSignOutException": null,

I/flutter ( 4454): │ "revokeTokenException": "RevokeTokenException {\n "message": "Failed to revoke token",\n "recoverySuggestion": "See underlyingException for more details",\n "underlyingException": "NetworkException {\n \"message\": \"The request failed due to a network error.\",\n \"recoverySuggestion\": \"Ensure that you have an active network connection\",\n \"underlyingException\": \"POST https://cognito-idp.eu-central-1.amazonaws.com/? failed: SocketException: Failed host lookup: 'cognito-idp.eu-central-1.amazonaws.com' (OS Error: No address associated with hostname, errno = 7)\"\n}"\n}",

I/flutter ( 4454): │ "signedOutLocally": true

I/flutter ( 4454): │ }

I/flutter ( 4454): └──────────────────────────────────────────────────────────────────────────────────────────────────────────────
`

Categories

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

Steps to Reproduce

  1. SignIn successfully
  2. AirPlane Mode on
  3. SignOut

Screenshots

No response

Platforms

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

Flutter Version

3.24.0

Amplify Flutter Version

2.3.0

Deployment Method

Amplify Gen 2

Schema

No response

@github-actions github-actions bot added pending-triage This issue is in the backlog of issues to triage pending-maintainer-response Pending response from a maintainer of this repository labels Aug 31, 2024
@lokalathlet lokalathlet changed the title signOut CognitoSignOutResult different behavior iOS and Android signOut CognitoSignOutResult different behavior on iOS and Android Aug 31, 2024
@NikaHsn
Copy link
Member

NikaHsn commented Sep 3, 2024

@lokalathlet Sorry that you are facing this issue and thanks for reporting it. We will look into this and get back to you when we have updates.

@NikaHsn NikaHsn added the auth Issues related to the Auth Category label Sep 3, 2024
@github-actions github-actions bot removed the pending-maintainer-response Pending response from a maintainer of this repository label Sep 3, 2024
@NikaHsn
Copy link
Member

NikaHsn commented Sep 6, 2024

@lokalathlet do you use sign-in with web UI?

@NikaHsn NikaHsn added the pending-community-response Pending response from the issue opener or other community members label Sep 6, 2024
@lokalathlet
Copy link
Author

@NikaHsn, you're right. In the Android usecase we're signing in via signing with webui. In the iOS usecase WE login via passkeys finally using signin method. I will doublecheck this, in case we are using passkeys on Android, we getting the same result: signout = false , if we are offline.

@github-actions github-actions bot added pending-maintainer-response Pending response from a maintainer of this repository and removed pending-community-response Pending response from the issue opener or other community members labels Sep 8, 2024
@lokalathlet
Copy link
Author

[debug] | 9:52:56 764ms | ::signOut result: CognitoSignOutResult { "hostedUiException": null, "globalSignOutException": null, "revokeTokenException": "RevokeTokenException {\n \"message\": \"Failed to revoke token\",\n \"recoverySuggestion\": \"See underlyingException for more details\",\n \"underlyingException\": \"NetworkException {\\n \\\"message\\\": \\\"The request failed due to a network error.\\\",\\n \\\"recoverySuggestion\\\": \\\"Ensure that you have an active network connection\\\",\\n \\\"underlyingException\\\": \\\"POST https://cognito-idp.eu-central-1.amazonaws.com/? failed: SocketException: Failed host lookup: 'cognito-idp.eu-central-1.amazonaws.com' (OS Error: No address associated with hostname, errno = 7)\\\"\\n}\"\n}", "signedOutLocally": true }
On Android it works as expected: sign in via passkeys, Set flight modeon, User Press logout, signedOutLocally": true

@tyllark
Copy link
Member

tyllark commented Sep 12, 2024

Hi @lokalathlet, could you please provide a code snippet for how you are signing in with passkey on iOS.

@github-actions github-actions bot removed the pending-maintainer-response Pending response from a maintainer of this repository label Sep 12, 2024
@Equartey Equartey added the pending-community-response Pending response from the issue opener or other community members label Sep 16, 2024
@Equartey
Copy link
Member

Hi @lokalathlet, if you're still experiencing this issue can you please provide a code snippet to help us reproduce the observed behavior?

@Equartey Equartey added the pending-close-response-required The issue will be closed if details necessary to reproduce the issue are not provided within 7 days. label Sep 19, 2024
@lokalathlet
Copy link
Author

lokalathlet commented Sep 23, 2024

Hi Equartey, here are the simplified steps how we sign in. It's the same for iOS and Android.
It must be clear that we can't provide a minimal working example with all the components of a working Cognito instance and Lambda stuff behind it. I assume that Amazon is in a position to have a running environment where it is possible to recreate the sign-out behavior itself. Let me know if this information is helpful. We flowing the documentation for Flutter authentication from the website.

 final signInResult = await _authCategory.signIn(
      username: username,
      options: const SignInOptions(
        pluginOptions: CognitoSignInPluginOptions(
          authFlowType: AuthenticationFlowType.customAuthWithoutSrp,
        ),
      ),
    );

// platform authenticator called here

 final jsonMap = {
      'response': {
        'credentialId': request.id,
        'authenticatorData': request.authenticatorData,
        'clientDataJSON': request.clientDataJSON,
        'signature': request.signature,
      },
      'challenge': authenticateChallenge,
    };

    final confirmSignInResult = await  _authCategory.confirmSignIn(jsonEncode(jsonMap));

@github-actions github-actions bot added pending-maintainer-response Pending response from a maintainer of this repository and removed pending-community-response Pending response from the issue opener or other community members labels Sep 23, 2024
@khatruong2009 khatruong2009 removed the pending-close-response-required The issue will be closed if details necessary to reproduce the issue are not provided within 7 days. label Sep 23, 2024
@Equartey Equartey added the question A question about the Amplify Flutter libraries label Oct 14, 2024
@github-actions github-actions bot removed the pending-triage This issue is in the backlog of issues to triage label Oct 14, 2024
@NikaHsn
Copy link
Member

NikaHsn commented Oct 16, 2024

@lokalathlet Amplify flutter Auth does not support signIn with passkey and based on my understanding you've implemented the signin with passkey yourself, correct me if I'm wrong.
Do you see this issue when using signin methods that are supported by Amplify Flutter Auth category rather than passkey?

@github-actions github-actions bot removed the pending-maintainer-response Pending response from a maintainer of this repository label Oct 16, 2024
@NikaHsn NikaHsn added the pending-community-response Pending response from the issue opener or other community members label Oct 16, 2024
@lokalathlet
Copy link
Author

@NikaHsn you are right. We use signInWithWebUI as an alternative. I will give it a try and come back to you.

@github-actions github-actions bot added pending-maintainer-response Pending response from a maintainer of this repository and removed pending-community-response Pending response from the issue opener or other community members labels Oct 17, 2024
@NikaHsn
Copy link
Member

NikaHsn commented Oct 17, 2024

@lokalathlet thanks for confirming. Let us know if you are facing this issue when using signInWithWebUI.

@github-actions github-actions bot removed the pending-maintainer-response Pending response from a maintainer of this repository label Oct 17, 2024
@NikaHsn NikaHsn added the pending-community-response Pending response from the issue opener or other community members label Oct 17, 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 pending-community-response Pending response from the issue opener or other community members question A question about the Amplify Flutter libraries
Projects
None yet
Development

No branches or pull requests

5 participants