Firebase Authentication with a custom Dart Server
This post describes my experiments using Firebase Authentication with a Dart Server application (for example, a shelf based web app). The scenario is that you have a client application (a Flutter Web app, for example) that you want to authenticate using Firebase, but the backend is your own custom web application instead of hosted Firebase services. Firebase Authentication is essentially free, and offers social login with all the usual suspects in addition to username/password and phone number authentication. Why roll your own IAM when you can get it for free? There are examples of this hybrid scenario for other languages where there is a Firebase admin SDK, but I couldn't find detailed notes on how to do this using Dart on the backend. Before we get to the solution (which turns out to be fairly simple), a quick detour into some of the workings of Firebase AuthN. Once Firebase successfully authenticates your client, it issues it an JWT Identity Token (idtoken). To play aro