Reputation: 135
I'm building SignUp/LogIn/Saving functionality in iOS app.
For SignUp/LogIn, I choose 'Firebase Auth'.
But, Firebase Auth can only save basic properties(ex. email address, password, URL, etc)
So, to save user's other properties, I'm planning to use additional MySQL DB separately.(By making user DB, user Table, userID primary key, and other columns)
To communicate with Firebase Auth and MySQL, I found that the user verification is a must.
And JWT(Json Web Token) will be used for verifying.
But, to verify users by using JWT, I think both Firebase Auth and MySQL must have common key(such as userID, E-Mail address, etc) in advance.
But I'm not sure whether this is the common way(easy and safe) or not.
I've read multiple threads,
Securely store Android Firebase Auth users in a MySQL database
Can i build an Android app that uses Firebase authentication but a custom database(eg MySQL)
Firebase, how to use auth service with a node.js RESTapi backend
But I couldn't get the first step of this process.
I have questions at this point.
Question1. So far, what I've understand is correct?
Question2. To verify user, at 'SignUp' step, do I need to store a common key in both Firebase Auth and MySQL in advance?
Question2-1-1. (If yes) Wouldn't it be a security problem by having identical data in Firebase Auth and MySQL? (Of course, I must not save any other private data(password, phone number, etc) in MySQL)
Question2-1-2. (If yes) What do you think of the best data for common key? (userID, E-Mail Address, auto-incremented userID, etc)
Question2-2. (If not) How can I sync Firebase and MySQL via iOS?
Question3. Then, this whole process is correct?
It is my first experience of building this functionality.
Please reply to my question!
Thank you in advance!
Upvotes: 1
Views: 1230
Reputation: 1399
No, you don't need to store a common key in advance.
You will get a JWT on your client (iOS device) when user does a sign in. Then you will attach this JWT to the header for every request to your server. Then on your server you will use this JWT to authenticate with Firebase, which will return you a user id if successful. And that you can store on your database.
Upvotes: 1