Firebase重定向到空白页面

时间:2018-04-19 16:19:12

标签: javascript html firebase webflow

我正在使用webflow构建网站,并且正在添加身份验证。我已设法添加所有基本代码以启用电子邮件登录。用户成功登录后会出现问题,当我将我的主页专门添加为重定向站点(在" signInSuccessUrl"之后指定)时,会导致重定向到空白页面。有谁知道为什么会这样?

在身体之前,标记

<script type="text/javascript">
  // FirebaseUI config.
  var uiConfig = {
    signInSuccessUrl: '<http://lundaspexarnas-superb-project.webflow.io/>',
    signInOptions: [
      // Leave the lines as is for the providers you want to offer your users.
      firebase.auth.GoogleAuthProvider.PROVIDER_ID,
      firebase.auth.FacebookAuthProvider.PROVIDER_ID,
      firebase.auth.EmailAuthProvider.PROVIDER_ID,
    ],
    // Terms of service url.
    tosUrl: '<your-tos-url>'
  };

  // Initialize the FirebaseUI Widget using Firebase.
  var ui = new firebaseui.auth.AuthUI(firebase.auth());
  // The start method will wait until the DOM is loaded.
  ui.start('#firebaseui-auth-container', uiConfig);
</script>

在开头之前,标记

<script src="https://cdn.firebase.com/libs/firebaseui/2.7.0/firebaseui.js"></script>
<link type="text/css" rel="stylesheet" href="https://cdn.firebase.com/libs/firebaseui/2.7.0/firebaseui.css" />

所有网页上的密码

<script src="https://www.gstatic.com/firebasejs/4.12.1/firebase.js"></script>
<script>
  // Initialize Firebase
  var config = {
    Config details
  };
  firebase.initializeApp(config);
</script>

2 个答案:

答案 0 :(得分:0)

如您在Firebase UI Demo中所见,signInSuccessUrl参数采用相对URL。就您而言,您必须像这样设置它:

signInSuccessUrl: '/'

答案 1 :(得分:0)

您需要确保在Firebase控制台的“授权”标签>“登录方法”>“授权域” 中列出了您的lundaspexarnas-superb-project.webflow.io域。