Skip to content

Commit

Permalink
Add support for headless login to firebase-auth.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Garnier committed Jan 27, 2016
1 parent 09aa7d5 commit b6952e7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions firebase-auth.html
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,17 @@
* provider-specific login parameters can be specified via attribute (JSON)/property,
* or via the `params` argument to the `login` function.
*
* If your `provider` is `custom` you must pass a Firebase Auth token as
* `params.token`. You can also optionally pass an auth token as `params.token` for
* providers `facebook`, `google`, `github` and `twitter` to login headlessly.
*
* If the login is successful, the `login` event is fired, with `e.detail.user`
* containing the authenticated user object from Firebase.
*
* If login fails, the `error` event is fired, with `e.detail` containing error
* information supplied from Firebase.
*
* If the browswer supports `navigator.onLine` network status reporting and the
* If the browser supports `navigator.onLine` network status reporting and the
* network is currently offline, the login attempt will be queued until the network
* is restored.
*
Expand Down Expand Up @@ -221,7 +225,9 @@
case 'google':
case 'github':
case 'twitter':
if (this.redirect) {
if (params.token) {
this.ref.authWithOAuthToken(this.provider, params.token, this._loginHandler.bind(this), params);
} else if (this.redirect) {
this.ref.authWithOAuthRedirect(this.provider, this._loginHandler.bind(this), params);
} else {
this.ref.authWithOAuthPopup(this.provider, this._loginHandler.bind(this), params);
Expand Down

3 comments on commit b6952e7

@ralcar
Copy link

@ralcar ralcar commented on b6952e7 Jan 31, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

signIn: function() {
this.$.authenticate.login();
},

this now gets an error, since i dont pass any params to the login function.
Error = row 228 : if (params.token) { << always null if login passed with no parameter

didnt happen before since this.redirect was false and this was not evaluated.

Am i required to pass a token now for Google as provider?

@nicolasgarnier
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah shoot. small bug. let me sent a PR to fix it...

@nicolasgarnier
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #107

Please sign in to comment.