1
votes

I'm transferring a large SQL database to firebase. I'm converting SQL to JSON and importing it into firebase. I have ran into a problem with the user table. I would like to import them into firebase authentication, but the user table looks like this

JSON format:

"members": [
            {
                "memb_num": "38803",
                "memb_email": "****@gmail.com",
                "memb_firstName": "**** ",
                "memb_lastName": "****",
                "memb_company": "*****",
                "memb_street1": "***** Road",
                "memb_street2": "",
                "memb_city": "Duarte",
                "memb_stateNum": "5",
                "memb_zip": "91010",
                "memb_country": "United States",
                "memb_phone": "619-925-0051",
                "memb_passwd": "5b387bd93ec6ae3f",
                "memb_passhint": "",
                "memb_passTemp": "none",
                "memb_communicate": "Receive E-mails",
                "memb_boxNum": "5417",
                "memb_boxSize": "large",
                "memb_acctType": "PLUS",
                "memb_24access": "No",
                "memb_payDue": "0000-00-00",
                "memb_termLength": "12",
                "memb_forms": "received",
                "memb_newMailNotify": "1",
                "memb_acctClose": "2019-02-02",
                "memb_added": "2016-02-02",
                "memb_lastOn": "2018-02-07 14:52:13",
                "memb_access": "customer",
                "isTestAccount": "No"
            }
]

I have a few questions.

  1. Will firebase Authentication accept all of this data or do I need to restructure it where only the email, password and uuid are present? I have over 30k members, so the easier the solution the better.

  2. What do I do about the password hash? This is what exporting it from the SQL database gives will it work once imported into firebase authentication?

1

1 Answers

3
votes

Check the documentation: https://firebase.google.com/docs/auth/admin/import-users. Many of the data above is better saved in a separate database. Firebase Auth supports custom user attributes which are embedded within the user's ID token but they recommend not using this as a database and instead use it for access control. In your case, using something like realtime database or Firestore to store the additional data is better suited.

Regarding the password hash, you have to provide the hashing algorithm option while importing your users. This is documented above.