Firebase Auth and Google Calendar using Polymer

情到浓时终转凉″ 提交于 2020-01-17 05:08:07

问题


Referencing Firebase Auth and Google Calendar, how do I do this with Polymer elements?

On my page, I added a google-signin element

<google-signin
   client-id="xxxx.apps.googleusercontent.com">
</google-signin>

I then waited for the google-signin-success event to be fired and got the access token with

gapi.auth2.getAuthInstance().currentUser.get().hg.access_token)

How do I login with firebase-auth? I tried adding the firebase-auth element like so in my page

<firebase-auth id="authenticate"
               user="{{user}}"
               location="{{location}}"
               ref="{{refauth}}"
               provider="google">
</firebase-auth>

and called it programmatically like so

  signIn: function() {
    var params = {token: "ya29.xxxxx"};
    this.$.authenticate.login(params);
  },

  signOut: function() {
    this.$.authenticate.logout();
    this.user = null;
  }
});

however, firebase-auth would still pop up a google signin dialog. How do I login with the access token?


回答1:


I found a working solution here Authenticate Firebase in Polymer using OAuth token although I expected firebase-auth login() method to work. As a workaround or till a better answer comes along, I'd recommend the solution above.

Update: Rev 1.0.12 of firebase-element now supports headless login using OAuth token.



来源:https://stackoverflow.com/questions/35195782/firebase-auth-and-google-calendar-using-polymer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!