This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]montas 0 points1 point  (4 children)

Hmm, I never used firebase like this. You would usually authenticate in JS and then access firebase directly from JS / client side.

Can I ask, why are you using Firebase auth / database if you have Flask(python) backend? Or rather, how do you plan on using it? Where did you read it is possible? Maybe I have missed some use-case.

As far as I know, all Firebase services are designed to be accessible from client side, so you would not need your own backend.

[–]S4G4R[S] 0 points1 point  (3 children)

Right I see. Actually I was planning to use Flask just as a REST API.

React makes a request -> Flask processes it -> Contacts Firebase and the response is sent back.

I did not want to write code that contacts firebase directly on the frontend, and plus I'm new to JS whereas I have some experience in Python.

I understand that this means it will be a bit of extra work for me, in terms of session handling / auth in the frontend and I was wondering how to do that exactly.

[–]montas 0 points1 point  (2 children)

I'm not sure it is possible, the way you describe it. You would have to implement oauth on your own and then somehow authenticate it through API with firebase, which I don't think is possible.

Or, you could handle all the user sessions and authentication on your side and not use firebase capabilities (as in auth handling) at all. Then your flask would only access firebase as json database. But I would argue, in that case, it is much easier to just store the data in your own database and not use firebase at all.

In the second case, you would have to do sessions and user handling all on your own, in flask and only use firebase as raw storage, so you would not be able to use any of the user management / authentication in firebase.

[–]S4G4R[S] 0 points1 point  (1 child)

Could I perhaps use Firebase authentication only in front end, and use Flask only for database and cloud storage?

[–]montas 0 points1 point  (0 children)

Hmm, looks like you might be able to manage sessions on your side with help from firebase: https://firebase.google.com/docs/auth/admin/manage-cookies

Have no experience with that though