From b6952e76e8f7fe9c1f58916dd91a40a2c486a878 Mon Sep 17 00:00:00 2001 From: Nicolas Garnier Date: Wed, 27 Jan 2016 15:56:54 +0100 Subject: [PATCH] Add support for headless login to firebase-auth. --- firebase-auth.html | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/firebase-auth.html b/firebase-auth.html index 5502bcd..fa2af7d 100644 --- a/firebase-auth.html +++ b/firebase-auth.html @@ -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. * @@ -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);