簡體   English   中英

firebase-admin SDK中的自定義authDomain?

[英]Custom authDomain in firebase-admin SDK?

我一直在查看firebase-admin SDK 文檔討論組,但找不到任何提示來使用我的域服務器端生成 signInWithEmailLink。

是否可以使用我的域在服務器端自定義登錄鏈接? 或者它只是可能在客戶端應用程序中?

使用您的身份提供商更新回調 URL,以使用您的自定義域而不是默認域。 例如,將https://myproject.firebaseapp.com/__/auth/handler更改為https://auth.mycustomdomain.com/__/auth/handler

這是我的實際工作,但我更喜歡最干凈的解決方案。

let link = await getAuth().generateSignInWithEmailLink(email, actionCodeSettings);

if(link.startsWith("https://myproject.firebaseapp.com")) {
  link = link.replace("https://myproject.firebaseapp.com", process.env.AUTH_URL);
}

轉到模板頁面,單擊編輯,然后單擊“自定義域”。
這樣做的好處在於它不僅會影響 Firebase 管理員。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM