npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

o2-auth-fs

v0.1.4

Published

Angular4 Library for Firebase Authentication

Downloads

7

Readme

o2-auth-fs Angular4 tool to authenticate users by Firebase through email, Google, Facebook, GitHub and Twitter login

MIT License

o2-auth-fs is a tool library for authenticating users by Firebase service by Angular4.

Video Explanation https://youtu.be/

Overview

  • o2-auth-fs is a tool for using Firebase authentication service by using Angular4

  • Main functions

    • Signup (using Firebase authentication service)
    • Login
      • Email
      • Google
      • Facebook
      • Twitter
      • GitHub
    • Logout

Prerequisite

  • Node.js
  • TypeScript2
  • Angular4
  • Firebase
  • bootstrap
  • font-awesome

Installation

To install this library, run:

$ npm install o2-auth-fs --save

Step by Step Installation for Angular-CLI

Install Angular-CLI

$ npm install -g @angular/cli

Create New Project

$ ng new demo-project (Your project name)
$ cd demo-project 

Check Your Program

If you start local server as follows, you can get the first page in your browser by accessing http://localhost:4200.

$ ng serve
  • First Page

Stop Local Server

Input Ctrl+C and y+Return to stop the local server.

Install o2-auth-fs

$ npm install o2-auth-fs --save

Install firebase

$ npm install firebase --save

Install bootstrap

$ npm install bootstrap --save

Modify .angular-cli.json

You will find .angular-cli.json in the project root directory. Add bootstrap.min.css as follows.


  "apps": [
    { 
      "styles": [
  // Add Start --------------------------------------------
        "../node_modules/bootstrap/dist/css/bootstrap.min.css",
  // Add End --------------------------------------------
        "styles.css"
      ],
    }
  ],

Get Firebase config data

Of course you need to have Firebase account and your own project. If you don't have the account, visit the following page in advance and make your own project.

https://www.firebase.com/login/

You need to get Firebase config data from your own project page. This url is as follows.

https://console.firebase.google.com/project/your-project-name/overview

You need the following parameters

  • apiKey
  • authDomain
  • databaseURL
  • projectId
  • storageBucket
  • messagingSenderId

In "Overview" page, click Web Application icon.

Then those parameters above will be shown. Copy them.

Modify environment.ts

Change directory to "src/app/environments".

$ cd src/app/environments

You will find environment.ts and environment.prod.ts. Modify these files as follows. In firebaseConfig, paste the data above.

export const environment = {
  production: true,
  // Add Start --------------------------------------------
  firebase: {
    apiKey: '"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
    authDomain: 'xxxxxxxxxxxxxxxxxx.firebaseapp.com',
    databaseURL: 'https://xxxxxxxxxxxxxxxxxx.firebaseio.com',
    projectId: 'xxxxxxxxxxxxx',
    storageBucket: 'xxxxxxxxxxxxx.appspot.com',
    messagingSenderId: 'xxxxxxxxxxxxxxxxxxxxx'
  }
  // Add End --------------------------------------------
};

Modify app.module.ts

Change directory to "src/app".

$ cd src/app

You will find app.module.ts. Modify this file as follows. AppRoutingModule and CoreModule will be made later.

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';

  // Add Start --------------------------------------------
import { O2AuthFsModule } from 'o2-auth-fs';
import { AppRoutingModule } from './app-routing.module';
import { CoreModule } from './core/core.module';
  // Add End --------------------------------------------

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
  // Add Start --------------------------------------------
    AppRoutingModule,
    CoreModule,
    O2AuthFsModule.forRoot()
  // Add End --------------------------------------------
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Modify app.component.ts

In the same directory, you will find app.component.ts . In this file, modify as follows.

import { Component, OnInit  } from '@angular/core';
  // Add Start --------------------------------------------
import { environment } from './../environments/environment';
import * as firebase from 'firebase';
  // Add End --------------------------------------------

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
  title = 'app-root';
  // Add Start --------------------------------------------
  loadedFeature = 'home';
  ngOnInit() {
    firebase.initializeApp(environment.firebase);
  }
  onNavigate(feature: string) {
    this.loadedFeature = feature;
  }
  // Add End --------------------------------------------
}

Add app-routing.module.ts

You had better independent modules for future. So add app.routing.module.ts in the project root directory. You need add flat option as follows.

$ ng generate module app-routing --flat

Add Core Module

You maybe need home page and header. They had better be included in core module which is almost always resided. At first you need add core module as foloows.

$ ng generate module core

Add Header Component

Next add header component in core module as folows.

$ ng generate component core/header

Add Home Component

Next add home component in core module as folows.

$ ng generate component core/home

Version

  • o2-auth-fs : 0.1.3
  • Angular : 4.2.4
  • TypeScript : 2.3.3
  • @angular/cli : 1.3.2
  • bootstrap : 3.3.7
  • firebase : 4.4.0
  • font-awesome : 4.7.0

Reference

Change Log

  • 2017.10.2 version 0.1 uploaded

Copyright

copyright 2017 by Shuichi Ohtsu (DigiPub Japan)

License

MIT © Shuichi Ohtsu