![](/img/trans.png)
[英]Getting "TypeError: user.getIdToken is not a function" when updating password in firebase
[英]how to solve "user.getIdToken() is not a function" error coming from a file I didn't create
所以我有一個簡單的 sveltefire 項目(svelte + firebase)。 我可以登錄,我可以退出,我可以創建一個帳戶。 在創建帳戶的組件中,我有這些代碼行:
let ActionCodeSettings = {url: 'https://www.Verify.com/?email=' + email };
await sendEmailVerification(email, ActionCodeSettings).then();
let result = getRedirectResult(auth);
但是,我從名為“email.ts”的文件中收到錯誤消息。 我沒有創建這個文件,但它給了我:
uncaught error in promise user.getIdToken() is not a function.
在我創建用戶之前,我把這些行發送一個 email 驗證,因為我不想有一個虛假的用戶。 它應該發送它,因為我剛剛輸入了 email。 是不是這個問題? 如果是這樣,是否有解決方法?
如果您查看sendEmailVerification
function的文檔,它期望User
object 作為其第一個參數,而您似乎傳遞的是 email 地址。
您需要傳入User
object,例如發送用戶驗證 email的文檔中所示:
mport { getAuth, sendEmailVerification } from "firebase/auth";
const auth = getAuth();
sendEmailVerification(auth.currentUser)
.then(() => {
// Email verification sent!
// ...
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.