Connect your web app to Firebase, your REST API will handle the authentication by receiving the user credentials , then authenticating with the Firebase through the web APIs Password Authentication. Use the Firebase server SDK to generate custom authentication tokens, the token will be a JSON Web Token (JWT).