簡體   English   中英

iOS/Swift - 如何驗證用戶的 email 與 Firebase 而不使用它進行身份驗證?

[英]iOS/Swift - How to verify a user's email with Firebase WITHOUT using it for auth?

(Swift/SwiftUI - iOS)我的應用程序允許使用電話號碼通過 firebase 身份驗證進行身份驗證。 用戶可以選擇在應用程序的首選項頁面中添加他們的 email 地址(用於接收營銷電子郵件,而不是用於身份驗證)。

有誰知道我是否可以使用 firebase 雲 function 來驗證這些用戶電子郵件但不將它們用於身份驗證? 我已經可以將用戶 email 保存到 firestore,我只想知道是否有辦法讓 firebase 到 email 用戶確認 email,然后例如將經過驗證的 boolean 值寫入 firebase。

我知道我可以使用 firebase 驗證電子郵件,但這些用戶沒有使用 email 注冊並且沒有密碼。 我也不想覆蓋他們的電話號碼作為 firebase 身份驗證的主要登錄方法,因為我不支持使用用戶名/密碼登錄。

您可以通過 Admin SDK 設置emailVerified屬性,這確實是您在 Cloud Functions 中使用的。 如果您查看有關更新用戶的文檔,您會找到有關如何執行此操作的示例:

getAuth()
  .updateUser(uid, {
    email: 'modifiedUser@example.com',
    phoneNumber: '+11234567890',
    emailVerified: true, // 👈
    password: 'newPassword',
    displayName: 'Jane Doe',
    photoURL: 'http://www.example.com/12345678/photo.png',
    disabled: true,
  })

暫無
暫無

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

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