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

[firebase_auth] Authentication State Persistence #1714

Closed
saisantosh2095 opened this issue Dec 25, 2019 · 10 comments
Closed

[firebase_auth] Authentication State Persistence #1714

saisantosh2095 opened this issue Dec 25, 2019 · 10 comments
Labels
blocked: customer-response Waiting for customer response, e.g. more information was requested. platform: web Issues / PRs which are specifically for web. plugin: auth resolution: needs-repro This issue could not be reproduced or needs an up to date reproduction on latest FlutterFire plugin. type: enhancement New feature or request

Comments

@saisantosh2095
Copy link

saisantosh2095 commented Dec 25, 2019

How to implement Auth state persistence on flutter web using firebase_auth package. Like (LOCAL,SESSION AND NONE)

Previously using firebase package was able to implement this feature ---

_firebaseAuth.setPersistence(Persistence.LOCAL).then((_) {
     //Perform user authentication here
    }).catchError((error) {
      print(error);
    });

But now i am unable to find this option in firebase_auth package after the support for web has been enabled.

@saisantosh2095 saisantosh2095 added the type: enhancement New feature or request label Dec 25, 2019
@saisantosh2095 saisantosh2095 changed the title [<firebase_auth>] <Authentication State Persistence> [firebase_auth] Authentication State Persistence Dec 25, 2019
@Jonas-Sander
Copy link

We are currently running our first beta of our flutter web app.
Our app is used mostly in schools and with the addition of the web not only on smartphones but also on shared computers.

This leaves wishing for a better way to handle auth state persistence like described in the web auth documentation.

@rjreid
Copy link

rjreid commented Feb 10, 2020

I'm also developing a flutter web app, and also need to be able to set the persistance.

In my case it appears that the default (which is "local" according to this https://firebase.google.com/docs/auth/web/auth-state-persistence) IS indeed what is occurring.

But while that may make sense for android/ios apps, where it will normally be a device owner exiting/restarting an app, it makes less sense for web apps which are more likely to be used on devices which other people may use. It is arguably a dangerous default setting as it exposes users data unless they explicitly log out.

So I would like to see the .setPersistence method added to this firebase_auth package (and/or the REST API) and/or a way to change the setting at the console level (perhaps via a security rule?) as my app will be primarily web-accessed.

@fearlessambassador
Copy link

Has this been recognized as a gap at this point? Is there a work-around? :)

@nilsreichardt
Copy link
Contributor

Any updates?

1 similar comment
@Chriszat
Copy link

Any updates?

@Ehesp Ehesp added platform: web Issues / PRs which are specifically for web. plugin: auth labels Apr 18, 2020
@dumbasPL
Copy link

dumbasPL commented May 9, 2020

Any updates?

@cad0p
Copy link

cad0p commented May 14, 2020

Same here, after a reload auth.currentUser() becomes null..

@Kuhno92
Copy link

Kuhno92 commented May 16, 2020

there is a workaround here: #1918

Instead of this:
await _firebaseAuth.currentUser();
use this:
await _firebaseAuth.onAuthStateChanged.first;

@cad0p
Copy link

cad0p commented May 18, 2020

Yeah, actually my implementation now has a timeout as well so it doesn't wait forever if something fails

          user = await _auth.onAuthStateChanged.timeout(
		    Duration(seconds: 1),
		    onTimeout: (eventSink) => eventSink.close()
	    )
		  .firstWhere(
			  (u) => u != null, orElse: () => null
	  );

@Salakar Salakar added blocked: customer-response Waiting for customer response, e.g. more information was requested. resolution: needs-repro This issue could not be reproduced or needs an up to date reproduction on latest FlutterFire plugin. labels Aug 25, 2020
@Salakar
Copy link
Member

Salakar commented Aug 25, 2020

Hey 👋

Our rework of the firebase_auth plugin as part of the FlutterFire roadmap was published over a week ago with a ton of fixes and new features. Please could you try the new version and see if this feature is still missing for you? If it is then please submit a new up to date GitHub issue explaining what's missing on the updated plugins.

See https://firebase.flutter.dev/docs/auth/usage#persisting-authentication-state

For help migrating to the new plugins please see the new migration guide: https://firebase.flutter.dev/docs/migration

@Salakar Salakar closed this as completed Aug 25, 2020
@firebase firebase locked and limited conversation to collaborators Sep 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
blocked: customer-response Waiting for customer response, e.g. more information was requested. platform: web Issues / PRs which are specifically for web. plugin: auth resolution: needs-repro This issue could not be reproduced or needs an up to date reproduction on latest FlutterFire plugin. type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests