A backend project sample with Firebase auth verification using dart_frog

frog_firebase_auth_sample

A sample backend project sample with Firebase auth verification using dart_frog.

☢️ This is a sample project and dart_frog is currently experimental. ☢️

How it works

This project uses postgres and firebase_auth_admin_verify.

For both these packages to work properly first you need to do some set-up.

  • Create a .env file at the root of the project which would include the data below for the postgres connection:

DB_HOST=
DB_PORT=
DB_NAME=
DB_USERNAME=
DB_PASSWORD=
  • For verifyFirebaseToken function to work properly, you either need to pass your Firebase project id from your Firebase console or you can use a service account json file.

  • Once this is done, don’t forget to get the packages

dart pub get
dart run build_runner build

This should generate frog.freezed.dart and frog.g.dart files.

  • All done!

Start the server

You can simply run dart_frog dev. For more information check out dart_frog.

If you are using VS Code, this project includes a launch configuration called froggy to start the dev server. So you can simply open one of the dart files and press F5 and start the dev server.

Aim of the project

This is a proof of concept to get user authentication through JWTs or Firebase auth in this case using dart_frog and continue with the usual cycle with DB changes.

GitHub

View Github