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

firebaseui-auth-angular

v0.2.0

Published

FirebaseUI Authentication for Angular provides simple, customizable components to make integrating Firebase authentication with Angular applications straightforward.

Downloads

19

Readme

FirebaseUi-Auth-Angular

FirebaseUI Authentication for Angular provides simple, customizable components to make integrating Firebase authentication with Angular applications straightforward.

Compatibility

This library is compatible with Angular 18 and utilizes standalone components for a cleaner import structure.

Installation

To get started, install the library along with its dependencies using npm:

npm install @angular/fire firebaseui-auth firebaseui-auth-angular --save

Ensure you have @angular/fire, and firebaseui-auth as prerequisites for this library.

Initialization

Before using the FirebaseUI components, initialize AngularFire within your Angular application:

import { initializeApp } from 'firebase/app';

const firebaseConfig = {
  // your Firebase project configuration
};

initializeApp(firebaseConfig);

Usage

Import and configure the FirebaseLogin component in your desired Angular component:

import { Component, inject, OnInit } from '@angular/core';
import {
  Auth,
  EmailAuthProvider,
  FacebookAuthProvider,
  GithubAuthProvider,
  GoogleAuthProvider,
  PhoneAuthProvider,
  TwitterAuthProvider,
} from '@angular/fire/auth';
import { FirebaseLogin } from 'firebaseui-auth-angular';

@Component({
  selector: 'app-main',
  templateUrl: './main.component.html',
  styleUrls: ['./main.component.scss'],
  standalone: true,
  imports: [FirebaseLogin],
})
export class MainComponent implements OnInit {
  auth: Auth = inject(Auth);
  uiConfig = {
    signInFlow: 'popup',
    signInOptions: [
      GoogleAuthProvider.PROVIDER_ID,
      {
        provider: FacebookAuthProvider.PROVIDER_ID,
        scopes: ['public_profile', 'email', 'user_likes', 'user_friends'],
        customParameters: { auth_type: 'reauthenticate' },
      },
      TwitterAuthProvider.PROVIDER_ID,
      GithubAuthProvider.PROVIDER_ID,
      { provider: EmailAuthProvider.PROVIDER_ID, requireDisplayName: false },
      PhoneAuthProvider.PROVIDER_ID,
    ],
    tosUrl: '<your-tos-link>',
    privacyPolicyUrl: '<your-privacyPolicyUrl-link>',
  };

  ngOnInit(): void {}

  logout(): void {
    this.auth.signOut();
  }

  successCallback(data: any): void {
    console.log('Login successful', data);
  }

  errorCallback(error: any): void {
    console.error('Login failed', error);
  }

  uiShownCallback(): void {
    console.log('UI shown');
  }
}

In your HTML, add the Firebase login component like so:

<firebase-login
  [auth]="auth"
  [uiConfig]="uiConfig"
  (signInSuccessWithAuthResult)="successCallback($event)"
  (signInFailure)="errorCallback($event)"
  (uiShown)="uiShownCallback()"
></firebase-login>

Callbacks

Configure sign-in success and failure callbacks to handle user authentication events:

  • Sign-In Success: Triggered when a user signs in successfully.
  • Sign-In Failure: Triggered if there is an error during the sign-in process.
  • UI Shown: Triggered when the authentication UI is displayed to the user.

Supporting the Project

Contributions, issues, and feature requests are welcome. Stay tuned for updates!

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

Kartik Watwani - [email protected]