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

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

Closed
FirdousNath opened this issue Feb 22, 2021 · 20 comments
Closed
Labels
Android Issues specific to the Android Platform auth Issues related to the Auth Category bug Something is not working; the issue has reproducible steps and has been reproduced fixed-in-release-candidate Issues that have been addressed in the current release-candidate branch requires-android-fix This issue is the result of an underlying Amplify Android issue that needs to be fixed.

Comments

@FirdousNath
Copy link

FirdousNath commented Feb 22, 2021

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 ?

@fjnoyp fjnoyp added the auth Issues related to the Auth Category label Feb 22, 2021
@rmargolinross
Copy link

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.

@haverchuck
Copy link
Contributor

Related to this amplify-android issue.

@haverchuck haverchuck added the requires-android-fix This issue is the result of an underlying Amplify Android issue that needs to be fixed. label Feb 24, 2021
@haverchuck
Copy link
Contributor

@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.

@raphire08
Copy link

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?

@FirdousNath
Copy link
Author

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

@dubeboy
Copy link

dubeboy commented Sep 7, 2021

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

@abhishekak048
Copy link

Any update?

@Ibessas
Copy link

Ibessas commented Oct 18, 2021

Same problem here

@abhishekak048
Copy link

Same problem here

Amplify configaration file remove all redirect code.

@Ibessas
Copy link

Ibessas commented Oct 19, 2021

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

@Lettly
Copy link

Lettly commented Oct 29, 2021

+1

@twink1e
Copy link

twink1e commented Dec 11, 2021

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?

@artahc
Copy link

artahc commented Jan 10, 2022

any update on this?

@Jordan-Nelson
Copy link
Member

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 Jordan-Nelson changed the title How to remove redirection upon sign out ? Remove browser redirection after signOut() in app using social sign in Jan 13, 2022
@Jordan-Nelson Jordan-Nelson added the Android Issues specific to the Android Platform label Jan 13, 2022
@Jordan-Nelson Jordan-Nelson added the bug Something is not working; the issue has reproducible steps and has been reproduced label Mar 8, 2022
@ken-ng-esotec
Copy link

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),
  );

@fuzzy28
Copy link

fuzzy28 commented Jun 12, 2022

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?

@Jordan-Nelson
Copy link
Member

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 Jordan-Nelson added the pending-release Issues that have been addressed in main but have not been released label Aug 2, 2022
@Jordan-Nelson
Copy link
Member

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 (#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 #530 a 👍

@HappyMakadiyaS
Copy link

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

@Jordan-Nelson Jordan-Nelson added the fixed-in-release-candidate Issues that have been addressed in the current release-candidate branch label Mar 2, 2023
@Jordan-Nelson Jordan-Nelson removed the pending-release Issues that have been addressed in main but have not been released label Mar 2, 2023
@Jordan-Nelson
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android Issues specific to the Android Platform auth Issues related to the Auth Category bug Something is not working; the issue has reproducible steps and has been reproduced fixed-in-release-candidate Issues that have been addressed in the current release-candidate branch requires-android-fix This issue is the result of an underlying Amplify Android issue that needs to be fixed.
Projects
None yet
Development

No branches or pull requests