Firebase身份验证不适用于Chrome

时间:2017-04-10 12:42:45

标签: javascript authentication firebase

我不知道它何时发生,因为在我开发时我在浏览器中启动了会话,因此我不必再通过Google或Facebook登录提供商。当新用户尝试在我的网络应用程序中登录时,她告诉我发生了错误。因此,当浏览器尝试打开Goog​​le或Facebook登录弹出窗口时,我清理了浏览器数据并开始显示消息A network error (such as timeout, interrupted connection or unreachable host) has occurred.。它不会在Safari或我的Android Chrome中发生。

以下是代码段作为参考。

<!--
@license
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->

<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../bower_components/paper-button/paper-button.html">
<link rel="import" href="../bower_components/polymerfire/polymerfire.html">
<link rel="import" href="shared-styles.html">

<dom-module id="my-view1">
  <template>
    <style include="shared-styles">
      :host {
        display: block;

        padding: 10px;
      }   
    </style>

   <div class="card">
      <div class="circle">1</div>
      <paper-button on-tap="login">Login</paper-button >
      <h1>View One</h1>
      <p>Ut labores minimum atomorum pro. Laudem tibique ut has.</p>
      <p>Lorem ipsum dolor sit amet, per in nusquam nominavi periculis, sit elit oportere ea.Lorem ipsum dolor sit amet, per in n#
    </div>
  </template>

  <script>
    Polymer({
      is: 'my-view1',

      login: function(){//{{{
        firebase.initializeApp({
          apiKey: apiKey,
          authDomain: authDomain,
          databaseURL: databaseURL
        });

        var provider = new firebase.auth.FacebookAuthProvider();
        firebase.auth().signInWithPopup(provider).then(function(result){
          console.log(result);
        }).catch(function(error){
          console.error( error);
        });
      },//}}}
    });
  </script>
</dom-module>

2 个答案:

答案 0 :(得分:0)

我认为您应该在有人点击登录之前初始化应用程序。

('70S ribosome','ALK tyrosine kinase receptor','ATP','ATP synthase)'
('70S ribosome','ALK tyrosine kinase receptor','ATP','ATP synthase)'

每当有人登陆页面时,也许是最好的地方。

答案 1 :(得分:0)

我转到chrome://settings/content/cookies并点击全部删除。这为我解决了。