Retrieving email address in Polymer Firebase-auth element using Google Authentication
Using Firebase Auth I want to get the email from google login, so I need the realm email. How can I add this to the firebase-auth element? Is it in the parameters? If so, how? An example would be great.
To help one of my developers create a Polymer item that has a login
https://github.com/HackITtoday/hi9-login/blob/master/hi9-login.html
thank
+3
source to share
2 answers
This can be done by calling one of the <firebase-auth>
less open APIs.
<firebase-auth
id="auth"
provider="{{provider}}"
app-name="[[appName]]"
signed-in="{{signedIn}}"
user="{{user}}"
on-error="onAuthError"></firebase-auth>
Inside Element Polymer Definition ...
// Currently supported providers are 'google', 'facebook', 'github', 'twitter'
loginUsingProvider: function(name) {
var provider = this.$.auth._providerFromName(name);
// Twitter simple login doesn't have scopes.
if (name != 'twitter') {
provider.addScope('email');
}
this.$.auth.signInWithPopup(provider)
.then(function(response) {
// success
}, function(error) {
// failure
})
.catch(function(exception) {
// Exception
});
}
This was done with polymerfire
version 0.9.4. Check your versions with bower install polymerfire
).
+2
source to share