angularfire2-offline icon indicating copy to clipboard operation
angularfire2-offline copied to clipboard

AngularFire2 Authentification

Open JaneDawson opened this issue 7 years ago • 4 comments

Thank you for this fantastic module!

How would you deal with the authentification to get the current user Id? Would you somehow have to add offline support for it, as well? Up to now I used AngularFireAuth ( import { AngularFireAuth } from 'angularfire2/auth'; ).

Thanks and best regards

JaneDawson avatar Jun 12 '17 08:06 JaneDawson

I'm not sure how you would access the current user id without it being stored on the device. I'll have to look into this more, but I can see how it would be useful. Anyone with ideas for this feature is welcome to leave feedback. Thanks!

adriancarriger avatar Jun 22 '17 12:06 adriancarriger

In my humble opinion and before this grows into a monster of a module, I suggest that storing authentication info is up to the consumer. The scope of this module should simply be offline data.

The more features you add, the more features there is to maintain.

edit Re-reading this, it sounds like I was telling. Sorry! Mean to only suggest it. 😄

larssn avatar Jul 03 '17 12:07 larssn

That would be great, yes.

I guess we should have some kind of AfoAuth service. We would use it like

import { AngularFireOfflineAuth } from 'angularfire2-offline/auth';

@Injectable()
export class someService {
  constructor(private afoAuth: AngularFireOfflineAuth) {
    afoAuth.authState.subscribe(user => {
      console.log(user);
    });
  }
}

And I'm not too sure about how it would work behind the scene, but I guess in the same way as database, by storing locally the latest fetched datas and then use those datas as default before trying to fetch remote datas ?

mparpaillon avatar Jul 20 '17 14:07 mparpaillon

firebase already stores the auth user in localstorage

ric-cardo avatar Jul 27 '17 07:07 ric-cardo