2017-04-10 1 views
1

내가 개발할 때 브라우저에 세션이 시작되어서 Google이나 Facebook으로 다시 로그인 할 필요가 없었기 때문에 언제 발생했는지 알 수 없습니다. 새 사용자가 내 웹 앱에 로그인을 시도 할 때 오류가 있음을 알았습니다. 그래서 브라우저 데이터를 정리하고 브라우저가 Google 또는 Facebook 로그인 팝업을 열려고 할 때 A network error (such as timeout, interrupted connection or unreachable host) has occurred. 메시지를 받기 시작했습니다. Safari 나 Android Chrome에서는 발생하지 않습니다.Firebase 인증이 크롬에서 작동하지 않습니다.

다음은 참조 용 코드 스 니펫입니다.

<!-- 
@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> 

답변

0

누군가가 로그인하기 전에 앱을 초기화해야한다고 생각합니다.

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

누군가가 페이지를 방문 할 때마다 가장 좋은 장소 일 수 있습니다.

+0

아니야. 그렇지 않아. 나는 그것을 시험해 본다. –

관련 문제