Polymer - Google Signin



<google-signin> is an element used for google authentication, where you can interact with Drive and Google+ APIs. Note − You need to enable the APIs in the Google Developers Console before you use them.

<google-signin client-id = "Your client id"
   scopes = "https://www.googleapis.com/auth/drive"></google-signin>

<google-signin label-signin = "Sign-in" client-id = "Your client id"
   scopes = "https://www.googleapis.com/auth/drive"></google-signin>

<google-signin theme = "dark" width = "iconOnly" client-id = "Your client id"
   scopes = "https://www.googleapis.com/auth/drive"></google-signin>

Some of the attributes are as follows −

Use the attributes height, width and theme to style the button by which you can follow the Google+ Sign-In button branding guidelines (https://developers.google.com/+/branding-guidelines).

The events are as follows −

  • google-signin-success − This event is triggered when a user is authenticated successfully. You can notice the authentication state of a user by using the isAuthorized attribute.

  • google-signed-out − This event is triggered when a user signs out.

  • google-signout-attempted − This event is triggered when a user attempts to sign out.

  • google-signin-offline-success − This event is triggered when a user attempts to sign out.

  • google-signin-necessary − This event is triggered when additional user permissions are needed by the scopes that are requested via google-signin-aware elements.

polymer_elements.htm
Advertisements