Firebase verify multiple email addresses for the same user

I'm using Firebase web SDK 4.0.0 and want to enable my users to verify multiple email addresses for the same account. For context, my objective is to receive email from dave@home.com and dave@work.com and know that it's definitely coming from Dave (uid 123456789).

I've looked up the docs about linking accounts but I'm assuming this approach isn't going to work as I need multiple emails.

I thought about storing the emails in the db and linking them to the user but that doesn't hook into the Firebase verification process (which I want to use).

Any ideas of how to approach this would be very helpful.


If you want a user have multiple emails registered in his account. You have to do the linking in the firebase database. Below is how to implement the structure in the database.

{
  "userAuth": {
    "userId001": {
      "userRNGId": "abc123",
      "userEmail": "example01@gmail.com"
    },
    "userId002": {
      "userRNGId": "abc123",
      "userEmail": "example02@gmail.com"
    }
  },

  "userList": {
    "abc123": {
      "userName": "James",
      "occupation": "Programmer",
      "userAccounts": {
        "userId001": {
          "userAuth": "userId001"
        },
        "userId002": {
          "userAuth": "userId002"
        }
      }
    }
  }
}

With this structure you can still use firebase authentication to verify their email address.

userId001 and userId002 is the RNG created from firebase authentication.

Inside userRNGId(Eg abc123) you should create random user ID so that all the emails will be linked to that id.

I hope it helps.

链接地址: http://www.djcxy.com/p/32342.html

上一篇: Firebase电话身份验证和链接

下一篇: Firebase会为同一用户验证多个电子邮件地址