首页 > 解决方案 > Ionic App:Firebase Authenticate with using OAuth Provider 显示 AUTH_DOMAIN 而不是自定义域

问题描述

我按照 Firebase Authentication docs ( Authenticate Using OAuth Providers with Cordova ) Link实现了使用 Google API 登录。但是,它显示项目默认 AUTH_DOMAIN。如何更改它以显示自定义 URL?

<universal-links>
    <host name="example.page.link" scheme="https" />
    <host name="example-app.firebaseapp.com" scheme="https">
        <path url="/__/auth/callback"/>
    </host>
</universal-links>

在此处输入图像描述

标签: firebasecordovaionic-frameworkfirebase-authenticationgoogle-oauth

解决方案


您在将 Firebase 添加到您的应用时是否设置了您的域?

<script src="https://www.gstatic.com/firebasejs/5.8.2/firebase.js"></script>
<script>
  // Initialize Firebase
  // TODO: Replace with your project's customized code snippet
  var config = {
    apiKey: "<API_KEY>",
    authDomain: "<PROJECT_ID>.firebaseapp.com",
    databaseURL: "https://<DATABASE_NAME>.firebaseio.com",
    projectId: "<PROJECT_ID>",
    storageBucket: "<BUCKET>.appspot.com",
    messagingSenderId: "<SENDER_ID>",
  };
  firebase.initializeApp(config);
</script>

此外,使用您自己的域并不像听起来那么容易。查看这篇文章了解更多信息。


推荐阅读