Testable Angular Firebase Authentication Boilerplate
Demo: https://angularfire-auth-app.firebaseapp.com
- Angular CLI Project.
- Utilizing Firebase Authentication.
- Full Unit Tests.
- Simple plain HTML, without decoration, so that you can easily extend it.
- Firebase Authentication provided from AuthService.
- AuthService tests using Mock for AngularFireAuth.
- AuthGuard for protecting routes.
- AuthService provided as singleton from separate core module.
- Different nav bar for Guest and Users.
- TravisCI integration to run the karma tests.
- TravisCI sending test coverage report to Codacy
- TravisCI deploy to Firebase only for Master branch.
- Snyk protection against vulnerable dependencies.
- Clone, download or fork this project.
- Create a Firebase project.
- Enable Google Authentication for your Firebase project:
- Select the
Auth
tab. - Select the
Sign-In Method
tab. - Enable
Google
sign-in providers.
- Select the
- Replace Firebase config, with your own project's config, in environment.ts
- Enable your project to integrate with TravisCI
- Enable your project with Codacy
- Press on
setup coverage
in your project in Codacy and copyproject token
- Go back to your TravisCI project and add the environment variable:
CODACY_PROJECT_TOKEN
=%Project_Token%
(replacing %Project_Token% with your token from Codacy)
The project is using two separate firebase projects. One for testing and one for production.
Settings for Firebase projects are identical with the difference that in production instance the localhost
domain in authentication is removed. This strategy gives an extra protection against mistakes in development and intruders.
- Enable Google Sign-in provider.
- Change
Public-facing name
fromgeneral settings
into something meaningful.
- Into
.firebaserc
replace the project name with your project. npm i -g firebase-tools
- cd into the root of your project and type
firebase login:ci
- follow the link provided to sign-in with your Google account.
- return to the terminal and copy the token provided.
- go to your TravisCI project -> settings and add to environment variables
FIREBASE_TOKEN
=%token%
(replacing %token% with the one that you copied before)