๐Ÿ“ฆ pbakondy / fbauth

Simple Google authentication with Angular Firebase

โ˜… 2 stars โ‘‚ 2 forks ๐Ÿ‘ 2 watching
angularfirebasegmail-login
๐Ÿ“ฅ Clone https://github.com/pbakondy/fbauth.git
HTTPS git clone https://github.com/pbakondy/fbauth.git
SSH git clone git@github.com:pbakondy/fbauth.git
CLI gh repo clone pbakondy/fbauth
Peter Bakondy Peter Bakondy rm 1fabd94 5 years ago ๐Ÿ“ History
๐Ÿ“‚ master View all commits โ†’
๐Ÿ“ e2e
๐Ÿ“ src
๐Ÿ“„ .editorconfig
๐Ÿ“„ .gitignore
๐Ÿ“„ angular.json
๐Ÿ“„ browserslist
๐Ÿ“„ karma.conf.js
๐Ÿ“„ package.json
๐Ÿ“„ README.md
๐Ÿ“„ tsconfig.app.json
๐Ÿ“„ tsconfig.json
๐Ÿ“„ tsconfig.spec.json
๐Ÿ“„ tslint.json
๐Ÿ“„ README.md

Simple Google authentication with Angular Firebase

This project was generated with Angular CLI version 8.3.19.

Initial Firebase Setup

  • Open Firebase Console
  • Create a new Project
  • Navigate to Authentication / Sign-in method
  • Enable Google provider (only)

Build project

ng new fbauth
cd fbauth

npm install @angular/fire firebase --save

ng generate service services/auth
ng generate component components/index
ng generate component components/user-profile
ng generate guard guards/auth

  • edit app.module.ts to initialize firebase settings
  • edit app-routing.module.ts to add routing rules
  • edit user-profile.component.ts and user-profile.component.html to setup Google login
  • edit auth.guard.ts to implement permission check for routes

Restrict by user

Google authentication handles only the login process.

You can restrict access (authorization) only by Firebase access rules: Firebase Console / Database / Rules .

Resources

  • https://fireship.io/lessons/angularfire-google-oauth/
  • https://stackoverflow.com/a/28422909