Giter VIP home page Giter VIP logo

demo-angular-6-login-auth's Introduction

Why another new Login system code ?

Because, I couldn't find one which supports multiple databases and I can re-use to support an Offline, Mobile and Progressive Web Apps at the same time.

Not until now

Angular 6.0 - One framework. Mobile & desktop

Objective:

My objective is to build one code base for a complete Login system usable across different devices, databases and platforms (at least most of it with minimum configuration changes).

Tools/Platforms

iOS, Android, Windows, Progressive Web Apps, Offline Desktop Apps for Mac, Linux and Windows
MYSQL, PostGreSQl, MariaDB, MS SQL, Oracle
Couch DB, Couchbase, Cloudant, Mondgo DB and FIREBASE

coming soon.. :

I will share my work to implement as SCHEMATICS, download from NPM or GitHUB Repo.

Rules First:

------------------------------------------------------ Rule #1 - Always use local css and SVG Icons
Rule #2 - All backend code (CRUD operations must be in Services)
Rule #3 - Prepare for i18n (Multilingual)
Rule #4 - Avoid DB specific operations
(else prepare for exceptions, like if FIREBASE is used for social auth, always give users a DB login system as alternate)
Rule #5 - No Hardcoded values and Local Storage variables
Rule #6 - Secure your database/datastorage with proper rules/authentications
Rule #7 - know your CORS
Rule #8 - Generalize your code
Rule #9 - No function is written more than 5 lines.
Rule #10 - GitHub is your only friend.

Let's Begin:

Check versions:

$ node -v
$ npm -v
$ ng -v

Create a new app

$ ng new myapp

Get Routing and Material:

$ ng g module shared/modules/AppRoutingModule
$ ng g module shared/modules/ElishCustomMaterialModule
// make sure these two modules are imported in app.module.ts
Let's copy these file content from my github repo
Copy assets/icons & assets/img

Create project skeleton:

$ ng g component aboutus // a filler component
$ ng g component shared/header // a sticky header component
$ ng g component shared/footer // a sticky footer component
Let's copy these file content from my github repo

Install AngularFire2 and firebase

$ npm install firebase angularfire2 --save
Import and initialize firebase settings in your app.module
import { AngularFireModule } from 'angularfire2';
import { AngularFirestoreModule } from 'angularfire2/firestore';
import { AngularFireStorageModule } from 'angularfire2/storage';
import { AngularFireAuthModule } from 'angularfire2/auth';
import { firebase } from '@firebase/app';
import { environment } from '.././environments/environment';

AngularFireModule.initializeApp(environment.firebase, 'atrackin'), // imports firebase/app needed for everything
AngularFirestoreModule, // imports firebase/firestore, only needed for database features
AngularFireAuthModule, // imports firebase/auth, only needed for auth features
AngularFireStorageModule

Let's create few more components and services:

$ ng g component settings // component where page lands after login is verified and can logout
$ ng g service services/auth-guard // used in router guard
$ ng g service services/back-end // used for all backend database services

Let's create login & signup components:

$ ng g component shared/login
$ ng g component shared/signup

copy over content

environment.ts, environment.prod.ts // update these files are per repo
backend and auth-guard // update these files are per repo
login and signup files // update these files are per repo

firebase settings

Please copy over environment settings and update environment.ts file
Please enable google, facebook and email login as sign-in methods to your firebase project.

ng serve

You have a complete login app now.

coming soon.. :

Very soon, instead of copying over contents from GitHub Repo - I will instead create SCHEMATICS. Stay Tuned and subscribe to my Blogs & Videos.

demo-angular-6-login-auth's People

Contributors

amitxshukla avatar

Watchers

Ansam Saleh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.