Posts

Showing posts from March, 2022

Firebase Authentication with a custom Dart Server

Image
  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 Id...

Notes on Firebase auth for Flutter Web

Flutter Web and Firebase Authentication with Google. Issue "not a valid origin" Notes to self... Despite registering the IntelliJ web server origin in the client OAuth2 settings in the  Cloud Console ,  (for example http://localhost:53006),  sign in with Google produces the error: Error: PlatformException(idpiframe_initialization_failed, Not a valid origin Not sure why the origin did not take in the console,  possibly because of firebase integration with google cloud?  Stackoverflow to the rescue:  https://stackoverflow.com/questions/65132622/firebase-google-signin-localhost-not-whitelisted   This configures Intellij to run the web server on port localhost:5000, which *is* auotmatically registered by firebase as a valid origin for local development.