EddyVerbruggen / nativescript-plugin-firebase

:fire: NativeScript plugin for Firebase
https://firebase.google.com
MIT License
1.01k stars 444 forks source link

IP: add support for 'remember me' functionality #629

Open r0zar opened 6 years ago

r0zar commented 6 years ago

I believe it requires adding support for firebase.auth().setPersistence() to:

https://github.com/EddyVerbruggen/nativescript-plugin-firebase/blob/master/src/platforms/android/typings/auth/android.d.ts

Reference: https://firebase.google.com/docs/auth/web/auth-state-persistence

EddyVerbruggen commented 6 years ago

Hi!

Just wondering.. what's IP: (in the title)?

Can you also share a reference to the iOS and Android SDK's please (this plugin doesn't use the web api).

r0zar commented 6 years ago

Ah, improvement proposal. I took the idea from bitcoin's BIPs.

I'm still looking for the source in the firebase android docs- but at least found this: https://github.com/firebase/FirebaseUI-Android/blob/master/auth/README.md#smart-lock which is somewhat close.

r0zar commented 6 years ago

I'm not picky on implementation, just want to have a 'remember me' feature somehow in my app.

EddyVerbruggen commented 6 years ago

If you had to roll your own implementation (because the SDK may not provide it, and FirebaseUI is not used in the project either), how would you do it?

r0zar commented 6 years ago

A simple implementation would be when 'remember me' is toggled, closing the app would not logout their session with firebase. If it's not toggled, users should be logged out when closing the app.

r0zar commented 6 years ago

I'll look into the docs on events related to closing apps. Possibly build a service around that.

jorotenev commented 6 years ago

Keen on seeing this functionality as well. Currently, after the user logs in, as expected the getAuthToken() returns a valid token. If the user switches to another app and after an hour switches back to our app, the the getAuthToken() still returns a token but it's already expired.

@r0zar let me know if I can help you out somehow.