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

Remove browser redirection after signOut() in app using social sign in

Open FirdousNath opened this issue 4 years ago • 18 comments

This behaviour is seen under android whenever I call Amplify.Auth.signOut() it opens up chrome with redirection link. I also tried removing metadata field inside amplifyconfiguration.dart file. "SignInRedirectURI": "", "SignOutRedirectURI": "",

Can someone know how to remove redirection ?

FirdousNath avatar Feb 22 '21 12:02 FirdousNath

I think I remember reading somewhere that in the iOS package, there is the option to just delete the auth token to sign out. That would be ideal to have for any social sign in on both ios and android if possible.

rmargolinross avatar Feb 23 '21 23:02 rmargolinross

Related to this amplify-android issue.

haverchuck avatar Feb 24 '21 20:02 haverchuck

@FirdousNath Are you using Hosted UI at all? If you are only using the standard APIs such as Auth.signIn and Auth.signOut, you can remove the entire "OAuth" block from your amplifyconfiguration.dart file. This would stop the behavior you are seeing.

haverchuck avatar Feb 25 '21 20:02 haverchuck

Hello, I removed the OAuth section from config file. The redirection behaviour has stopped. The login and logout is working. But, getting an error in console for Android simulator only after that.

_federatedSignIn: Putting provider and token in store W/AWSMobileClient(12345): Failed to federate tokens during sign-in W/AWSMobileClient(12345): java.lang.Exception: Federation is not enabled, please check if you have CognitoIdentity configured.

How to get rid of this without changing the actual configuration in aws?

raphire08 avatar Mar 11 '21 09:03 raphire08

Nothing helped so far, I removed everything still the same. What I did to override is I included a deep link to my app which in turns reopen my app

FirdousNath avatar Jun 18 '21 05:06 FirdousNath

I was wondering if there is any progress regarding this issue?

dubeboy avatar Sep 07 '21 06:09 dubeboy

Any update?

abhishekak048 avatar Sep 18 '21 05:09 abhishekak048

Same problem here

Ibessas avatar Oct 18 '21 20:10 Ibessas

Same problem here

Amplify configaration file remove all redirect code.

abhishekak048 avatar Oct 19 '21 03:10 abhishekak048

I'm using the signInWithWebUI, so i need the redirects and on amplify.configure it's thrown a error, i'm using the signInWithWebUI for social signIn

Ibessas avatar Oct 19 '21 13:10 Ibessas

+1

Lettly avatar Oct 29 '21 17:10 Lettly

I'm using email sign in without UI, and social sign in with UI at the same time, so I have to include the OAuth and redirect section in amplify config file. How can I stop the logout redirect web from being popped up when user sign in with email or after logout?

twink1e avatar Dec 11 '21 14:12 twink1e

any update on this?

artahc avatar Jan 10 '22 06:01 artahc

As of now, the Amplify-Android library, which Amplify-Flutter depends on, does not officially support social sign in and username based sign in within the same app. The amplify-android issue linked above is the feature request for that in Amplify-Android. If this is a feature you are looking for, you can give that issue a 👍 to show your support.

Jordan-Nelson avatar Jan 10 '22 20:01 Jordan-Nelson

To overcome this issue, do global sign out so that the browser redirect is skipped.

  final SignOutResult res = await Amplify.Auth.signOut(
    options: const SignOutOptions(globalSignOut: true),
  );

ken-ng-esotec avatar Mar 27 '22 07:03 ken-ng-esotec

To overcome this issue, do global sign out so that the browser redirect is skipped.

  final SignOutResult res = await Amplify.Auth.signOut(
    options: const SignOutOptions(globalSignOut: true),
  );

This works @ken-ng-esotec ! thanks!

Also, anyone has encountered like when authenticating thru google / Facebook, if there's only one account logged in, it automatically registers that account without asking to choose another account?

fuzzy28 avatar Jun 12 '22 03:06 fuzzy28

Hello everyone - We have recently released a new developer preview version of the Auth category (amplify_flutter v1.0.0-next.0). This new version is a full re-write of the auth category in dart, and it supports Mobile, Desktop, and Web. This issue is addressed in this new version. You can read more about the developer preview release in the blog post and docs. I will update this issue again once this new version is out of developer preview.

Let me know if you have any questions!

Jordan-Nelson avatar Aug 02 '22 19:08 Jordan-Nelson

I wanted to add some additional info about this issue and what has been resolved in the dev-preview release.

When using Social Sign In / Hosted UI, Cognito sets a token in the browser. This token needs to be cleared upon sign out as it allows someone to obtain a Cognito session without re-authenticating. The browser redirection seen on sign out is caused by Amplify launching a browser to clear this token.

In the current stable version of Amplify (v0.6.x), when targeting Android, this browser opens on sign out when Hosted UI is enabled in your app, even if the user did not sign in via Hosted UI. This is a bug. The browser should only be launched if the user signed in via hosted UI since there is nothing to clear if another sign in method was used (username/password). This bug has been resolved in the latest dev-preview release (v1.x.x).

The browser does still launch on Sign Out if a user is signed in via Hosted UI. However, in the dev-preview release this should be much less noticeable as it does not redirect to a new window.

We have a separate feature request (https://github.com/aws-amplify/amplify-flutter/issues/530) open to remove all system dialogs and browser windows on sign out for users that did sign in via Hosted UI. If you are looking to suppress all dialog/browser windows, you can give https://github.com/aws-amplify/amplify-flutter/issues/530 a 👍

Jordan-Nelson avatar Aug 23 '22 15:08 Jordan-Nelson

Hey, @Jordan-Nelson
When the version 1.0.0 scheduled for production release? As we have to fix this in a production application.

HappyMakadiyaS avatar Jan 04 '23 17:01 HappyMakadiyaS

This issue has been addressed in v1.0.0 of Amplify Flutter, which is now stable. See the comment above for details on what was changed in this version with regards to this issue.

This release also includes web and desktop support for Auth, API, Analytics, and Storage. You can see the list of new features and bug fixes in the release notes, and see more details on how to migrate in the upgrade guide.

Jordan-Nelson avatar Apr 17 '23 18:04 Jordan-Nelson