How to use firebase to authenticate next.js/react against flask backend
I’m migrating my frontend away from Flask to next.js, reducing my flask app to only backend apis.
This blogpost explains how a next.js app authenticates against flask backend using flask-login.
It assumes that you have in your flask backend:
- an endpoint
auth/sign-inwhich…- accepts a POST request with the firebase idToken
- checks the token against firebase
- when successful, logs it in with flask_login’s
login_user
- your api routes secured with @login_required



