1

我正在使用 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>
4

2 回答 2

2

正如您在Firebase UI Demo中看到的那样,该signInSuccessUrl参数采用相对 URL。在您的情况下,您必须像这样设置它:

signInSuccessUrl: '/'
于 2018-10-03T18:36:36.467 回答
1

您需要确保您的 lundaspexarnas-superb-project.webflow.io 域列在Firebase 控制台的授权选项卡 > 登录方法 > 授权域中。

于 2019-05-09T15:17:21.287 回答