GoogleWebComponents / google-signin

Google Sign-in web component
https://elements.polymer-project.org/elements/google-signin
Other
278 stars 88 forks source link

documentation is inconsistent about which element to use or not. #143

Open ktiedt opened 8 years ago

ktiedt commented 8 years ago

In google-signin element you state:

If you do not need to show the button, use companion element to declare scopes, check authentication state.

And in google-signin-aware you state:

google-signin-aware is used to enable authentication in custom elements by interacting with a google-signin element that needs to be present somewhere on the page.

The former seems to imply a signin element is not needed, the latter implies it is required... Which begs the question, is the only purpose of signin-aware to notify you of states of specific scopes?

atotic commented 8 years ago

google-signin docs are correct. google-signin-aware docs did not get updated when code was rewritten. Pull requests welcome :)

ktiedt commented 8 years ago

The demo also seems to be in line with the google-signin-aware docs, if I understood what actually was expected, I would be happy to update things, but at this level of confusion, w/zero knowledge of the elements, updating documentation would probably be the least helpful thing I could do right now.

Zoramite commented 8 years ago

Hi @ktiedt I'll take a stab at updating the documentation. Sorry that it isn't very clear.

The idea is that there is at least one signin button on the page using the google-signin element. Other components can bind to the signin events and add their own additional scopes through the google-signin-aware element. From there the signin button reacts to the scopes to request the correct permissions and the signin aware makes other elements aware of changes to the signin state and scopes.

atotic commented 8 years ago

google-signin is only required for UI. If developer does not want to use our UI, they can use signin-aware to interact with oauth API.

Zoramite commented 8 years ago

That is true, developers can also manually trigger the signin. I'll be sure to mention that.

ktiedt commented 8 years ago

Ahh, so signin-aware is actually the brains, the -aware makes it sound more like a secondary element. Sorting that out in my head makes things a lot more clear

Zoramite commented 8 years ago

Yeah, if you look at the google-signin component it actually just calls the signin on the aware element:

https://github.com/GoogleWebComponents/google-signin/blob/master/google-signin.html#L536

atotic commented 8 years ago

google-signin got rewritten. In the initial version, google-signin was the brains, and aware was something else. Hence the confusion. Today, google-signin is just a UI on top of signin-aware. We kept the API backward compatible, so it gets a little confusing.