Search code examples
firebasefirebase-authentication

How to get oobCode for localization purpose


Firebase allows only one language for confirmations emails. Whole nicely done products are useless for multi-language apps. I want to make my own confirmation system. The only question is how can I get this oobCode which is generated inside firebase. site.com?mode=&oobCode=

Thank you.


Solution

  • There is currently no way to generate a valid oobCode value through the Firebase Authentication API. It can only be sent in the (as you've said "non-translatable") email message.

    But you can build your own email verification mechanism if you want, using your own confirmation code to verify email ownership. You'd:

    1. Generate a random, unguessable code on a server
    2. Send it to the user's email address and then
    3. When the user clicks the confirmation link, have your own end point on the same server that you call back to
    4. At this point you can use the Firebase Admin SDK to set the emailVerified property to true.

    For an example of the last step, see: https://firebase.google.com/docs/auth/admin/manage-users#update_a_user

    Thanks to @Nikhil in the comments: Alternatively you can roll your own verification altogether and use the Admin SDK to set emailVerified to true. See the Firebase documentation for an example of that.