☰ 內容

單點登錄


此功能使用 Google Firebase,並允許使用 Google、Firebase 電子郵件和密碼、Facebook 和 Github 登入

設置

我們需要一個Firebase項目,那我們來配置 Disciple.Tools.

Firebase 應用程式配置

創建一個 firebase 項目 https://console.firebase.google.com 任何名字。 不需要分析。

網絡應用

從儀表板中點選“應用程式網路”。 選擇任何暱稱。 儲存如下所示的設定。 我們稍後會需要它們。

const firebaseConfig = {
  apiKey: "AIza-***",
  authDomain: "disciple-tools-auth.firebaseapp.com",
  projectId: "disciple-tools-auth",
  storageBucket: "disciple-tools-auth.appspot.com",
  messagingSenderId: "*********",
  appId: "******"
};

認證

從左側選單中選擇“建置”,然後選擇“身份驗證”。

在「身份驗證」標籤上,新增要啟用的提供者(Google、電子郵件和通行證、Facebook 等)。

谷歌範例:

按一下新增提供者。 然後是谷歌。 啟用提供者。 選擇使用者將看到的名稱,例如“disciple-tools-auth”。

允許的域

轉到“設定”選項卡。 在授權域下,新增您的DT實例的網域。 例: ”disciple.tools“ 或 ”*。disciple.tools“

DT設定

前往「設定 (DT)」>「SSO 登入」。 在多站點上,使用 DT 多站點插件,前往網路管理 > Disciple.Tools > 單一登入。

打開 Firebase 選項卡。

在上面的 firebaseConfig 中,將 apiKey 值 AIza... 新增至 Firebase API 金鑰,將 projectId 值新增至 Firebase 專案 ID,將 appId 新增至 Firebase 應用程式 ID。 單擊儲存。

在「常規」標籤上,將「啟用自訂登入頁面」設定為「開啟」並儲存。

在「身分提供者」標籤上,將「Google」提供者設定為「開啟」並儲存。

退出並嘗試!

疑難排除

  • 錯誤訊息“Class“Firebase\JWT\Key”未找到”可能表示正在使用舊版的行動應用程式插件。



章節內容

上次修改時間:22年2023月XNUMX日