1
0

More than 1 year has passed since last update.

[Firebase][iOS] メールアドレス更新前に確認メールを送る

Last updated at Posted at 2021-12-07

Firebase Authentication のユーザーのメールアドレスを更新する方法として、
「新しいメールアドレスに認証メールが送られ、リンクがクリックされると更新される」関数があります。

// newEmail に確認メールが送信されます。メールのリンクをクリックすると newEmail に変更されます。
Auth.auth().currentUser?.sendEmailVerification(beforeUpdatingEmail: newEmail) { error in
    // ...
}

ちなみに、以下のコードだとメール認証なしで変更されます。

Auth.auth().currentUser?.updateEmail(to: email) { error in
    // ...
}

追記(2021/12/12)
エミュレータを使用中は、sendEmailVerification(beforeUpdatingEmail:)をすると内部エラーが返ってくるみたいです。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0