I have a Firebase database that authenticates with a Google account. Currently I have a <google-signin-aware>
element that details the app's sign-in details for use with the Google Sign-in API, and upon sign-in authenticates a Firebase reference with the access token returned by the Google sign-in.
From the callback for <google-signin-aware>
element on successful sign-in:
var ref = new Firebase("https://<myapp>.firebaseio.com");
var access_token = gapi.auth2.getAuthInstance().currentUser.get().getAuthResponse().access_token;
ref.authWithOAuthToken("google", access_token, function (error, authData){/*...*/});
To try to integrate further with Polymer, I'm migrating to the <firebase-auth>
element which is a "wrapper for the Firebase authentication API". However I cannot find an equivalent method to authenticate with an access token. The login()
method has two parameters, is there any way to feed the access token to the login method so that Firebase authenticates with this token rather than its own pop-up window?
You might be interested by my custom set that extends Firebase Polymer element set: https://github.com/MeTaNoV/firebase-element-extended
The
<firebase-auth>
element has an internal Firebase referenceref
that you can access by callingAnd then auth as normal