【问题标题】:Firebase Auth and Google Calendar using Polymer使用 Polymer 的 Firebase 身份验证和 Google 日历
【发布时间】:2016-05-13 18:08:16
【问题描述】:

引用Firebase Auth and Google Calendar,我该如何使用 Polymer 元素?

在我的页面上,我添加了一个 google-signin 元素

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

然后我等待google-signin-success 事件被触发并通过

获得访问令牌
gapi.auth2.getAuthInstance().currentUser.get().hg.access_token)

如何使用 firebase-auth 登录?我尝试在我的页面中添加 firebase-auth 元素

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

并像这样以编程方式调用它

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

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

但是,firebase-auth 仍然会弹出一个 google 登录对话框。如何使用访问令牌登录?

【问题讨论】:

    标签: firebase polymer-1.0


    【解决方案1】:

    我在Authenticate Firebase in Polymer using OAuth token 找到了一个可行的解决方案,尽管我希望 firebase-auth login() 方法可以工作。作为一种解决方法或在出现更好的答案之前,我会推荐上述解决方案。

    更新: firebase-element 1.0.12 版现在支持使用 OAuth 令牌进行无头登录。

    【讨论】:

    猜你喜欢
    • 2015-05-10
    • 2017-10-29
    • 2018-06-26
    • 2012-05-29
    • 1970-01-01
    • 2018-07-07
    • 2016-09-26
    • 2019-05-20
    • 1970-01-01
    相关资源
    最近更新 更多