GoogleWebComponents / firebase-element

Web components for the Firebase Web API
https://elements.polymer-project.org/elements/firebase-element
95 stars 72 forks source link

Add authenticated event #115

Closed redbassett closed 7 years ago

redbassett commented 8 years ago

The firebase-auth element provides events for on-login, on-error, and on-logout, however there is no event fired when Firebase confirms the lack of a logged in user. This pull request adds such an event (tentatively called authenticated), which is fired any time the ref's authentication state changes (due to the callback provided to ref.onAuth). This can also be thought of as being called whenever statusKnown is set to true.

To use the authenticated event, simply add an on-authenticated argument to the firebase-auth element with a value representing the name of the method to call. Note that this method will be called every time the authentication state changes (including logins, logouts, and page reloads).

ebidel commented 8 years ago

Hi any updates on my feedback?

redbassett commented 8 years ago

Sorry, I've been away from this issue for a while (and will be for a while longer). I also haven't had time to look into the google-signin element yet, however I'm all for consistency between the sign-in process for the two.

ebidel commented 8 years ago

Ah, np. It was just a suggestion on naming. I think we're pretty close on this!

MartinGerritsen commented 8 years ago

Thanks for pointing me to this one. It is spot on to what I desire! The name login-attempt also makes sense to me, since it has been nothing more than an attempt.

redbassett commented 8 years ago

Yeah, the names here were originally going to be based off of the Firebase JS API, however the process of using a Polymer element is already different enough that switching to the naming convention used by another similar element makes sense.