I'm new to Polymer and Firebase (and as a programmer as well), I'm trying to do a simple login with Google and show the user is logged in. Google Auth is enabled in Firebase. The logout button should be hidden when there is no user logged in, but when I click the login button, nothing happens. There are no warnings in the browser's console. Here is the code that I'm using:
<!DOCTYPE html>
<html>
<head>
<link rel="import" href="bower_components/polymerfire/firebase-app.html">
<link rel="import" href="bower_components/polymerfire/firebase-auth.html">
<link rel="import" href="bower_components/paper-button/paper-button.html">
</head>
<body>
<firebase-app
auth-domain="xxx"
database-url="xxxx"
api-key="xxxxx">
</firebase-app>
<firebase-auth
id="auth"
user="{{user}}"
status-known="{{statusKnown}}"
provider="google">
</firebase-auth>
<template is="dom-if" if="[[user]]">
<h1>Welcome [[user.displayName]]</h1>
</template>
<paper-button raised on-tap="login" hidden$="[[user]]">Sign In</paper-button>
<paper-button raised on-tap="logout" hidden$="[[!user]]">Sign Out</paper-button>
</body>
<script>
Polymer({
is: 'my-login',
properties: {
user: {
type: Object
},
statusKnown: {
type: Object
}
},
login: function() {
return this.$.auth.signInWithPopup();
},
logout: function() {
return this.$.auth.signOut();
},
});
</script>
</html>