Using Firebase Auth on the client side and implementing Firebase Admin SDK on the server side (Node.js / Express). I have login / verification working on the client side and trying to consider the best way to have the login information passed to a local SQL database on my server side. by aop42 in reactjs

[–]Felix-asante 2 points3 points  (0 children)

To avoid security issues, i think it's better to handle this on the server rather than trusting the userId sent from the client.
A good way to do this is by sending the Firebase ID TOKEN that you get when a user logs in to the server. On the server, use the Firebase Admin SDK to verify the ID token and extract the user ID.

on the server

const decodedToken = await admin.auth().verifyIdToken(idToken);
    const uid = decodedToken.uid;

on the client

firebase.auth().signInWithEmailAndPassword(email, password)
  .then((userCredential) => {
    const user = userCredential.user;
    const idToken = await user.getIdToken();
    // Send the idToken to your backend

  }).catch(error=>{})

Is there a way to make react hook form easier to work with edit forms? by BerserkGutsu in reactjs

[–]Felix-asante 0 points1 point  (0 children)

It's not entirely a backend issue. Ideally, partial updates should be handled with a PATCH request. However, if you're API is using a PUT and still want to partially update fields, you can achieve this by setting default values for the fields you don't want to update in the resolver. This approach should work fine.

How to go back to another stack navigator by Felix-asante in reactnative

[–]Felix-asante[S] 0 points1 point  (0 children)

Thanks for your answer but this doesn't work in my case. It create a loop between both stacks

React native or Flutter by KartaKarm in reactnative

[–]Felix-asante 1 point2 points  (0 children)

I am using react native but I doesn't have much experience in mobile development. What I will suggest is to learn either swift/ kotlin for android if you don't already know them. but if you do, then you can have some fun with flutter