It's ok to use the Firebase sdk library for the client on my nodejs server?

Viewed 67

I have one question about firebase auth. I have a nodejs server api and a react web client application and i want to implement auth with server-side session cookie management.

I've been following the Firebase documentation and saw that they advise implementing client-side authentication and my question is why this should be the case?

I want to handle all the server side authentication and abstract that logic from the client. The client sends email and password and then on the server authenticates with the firebase SDK library and then exchanges it for a session cookie.

Is there any negative point that I am not seeing to do it like this? What are your recommendations on this?

Thanks!!

1 Answers

Doing this with the Node.js client-side SDK on a server, is similar to calling the REST APIs. It can definitely work, but you're going to be missing out on a lot of functionality of the SDKs, such as automatic caching of tokens and credentials, and automatic refreshing of ID tokens. But if that's what you want, it is possible. After all, that's precisely what the Firebase SDK also does.

Related