All Projects → RaphaelJenni → Firebaseui Angular

RaphaelJenni / Firebaseui Angular

Licence: apache-2.0
A wrapper for FirebaseUI in Angular

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Firebaseui Angular

Stripe Firebase Extensions
Repository of Firebase Extensions built by Stripe.
Stars: ✭ 133 (-45.71%)
Mutual labels:  firebase, firebase-auth
Angularfire Lite
⚡️ Lightweight library to use Firebase API 🔥 with Angular
Stars: ✭ 245 (+0%)
Mutual labels:  firebase, firebase-auth
React Firebase Hooks
React Hooks for Firebase.
Stars: ✭ 2,227 (+808.98%)
Mutual labels:  firebase, firebase-auth
Firebasecrud
Rich UI and animation flutter app backed by firebase
Stars: ✭ 121 (-50.61%)
Mutual labels:  firebase, firebase-auth
Firebase Admin Dotnet
Firebase Admin .NET SDK
Stars: ✭ 201 (-17.96%)
Mutual labels:  firebase, firebase-auth
Quickstart Cpp
Firebase Quickstart Samples for C++
Stars: ✭ 123 (-49.8%)
Mutual labels:  firebase, firebase-auth
React Firebase
🔥Declarative React bindings for Firebase Auth & Realtime Database.
Stars: ✭ 176 (-28.16%)
Mutual labels:  firebase, firebase-auth
Firebase Php
Unofficial Firebase Admin SDK for PHP
Stars: ✭ 1,657 (+576.33%)
Mutual labels:  firebase, firebase-auth
Nodejs Auth
Implementation of node.js authentication with social login ✌️, user impersonation 💅, and no passport.js required 💁
Stars: ✭ 201 (-17.96%)
Mutual labels:  firebase, firebase-auth
Next Firebase Ssr
An Next.js example repo for building authenticated pages with Firebase Authentication, cookies, and getServerSideProps
Stars: ✭ 192 (-21.63%)
Mutual labels:  firebase, firebase-auth
Firebase Subscription Payments
Example web client for the `firestore-stripe-subscriptions` Firebase Extension using Stripe Checkout and the Stripe Customer Portal.
Stars: ✭ 119 (-51.43%)
Mutual labels:  firebase, firebase-auth
Tailor made
✄ Managing a Fashion designer's daily routine.
Stars: ✭ 219 (-10.61%)
Mutual labels:  firebase, firebase-auth
Bento Starter
🍱 Full-Stack solution to quickly build PWA applications with Vue.js and Firebase
Stars: ✭ 1,519 (+520%)
Mutual labels:  firebase, firebase-auth
Petshop
Pet Shop is an e-commerce application for Android built with Flutter (iOS to come soon).
Stars: ✭ 127 (-48.16%)
Mutual labels:  firebase, firebase-auth
React Most Wanted
React starter kit with "Most Wanted" application features
Stars: ✭ 1,867 (+662.04%)
Mutual labels:  firebase, firebase-auth
Space
A real time chat app for developers built using React, Redux, Electron and Firebase
Stars: ✭ 161 (-34.29%)
Mutual labels:  firebase, firebase-auth
React Mobx Firebase Authentication
🔥Boilerplate Project for Authentication with Firebase in React and MobX
Stars: ✭ 111 (-54.69%)
Mutual labels:  firebase, firebase-auth
React Native Firebase Chat
React Native chat application using firebase.
Stars: ✭ 113 (-53.88%)
Mutual labels:  firebase, firebase-auth
Makeitso
This is the source code for Make It So, the sample app accompanying my blog post "Replicating the iOS Reminders App Using SwiftUI and Firebase"
Stars: ✭ 181 (-26.12%)
Mutual labels:  firebase, firebase-auth
Firebase Kotlin Sdk
A Kotlin-first SDK for Firebase
Stars: ✭ 214 (-12.65%)
Mutual labels:  firebase, firebase-auth

Build Status npm version

FirebaseUi-Angular

Screenshot of Login screen

Compatibility

Angular Firebase AngularFire FirebaseUI FirebaseUI-Angular Note
11.0.2 ^8.2.4 ^6.1.1 ^4.7.2 5.1.2 support for auth emulator
11.0.2 ^8.1.1 ^6.1.1 ^4.7.1 5.1.1
10.2.2 ^8.0.1 ^6.0.4 ^4.7.1 5.1.0
~8.2.13 ^7.23.0 ~5.2.1 ~4.7.1 ~4.0.1

Version combinations not documented here may work but are untested.

Installation

To install this library, run:

$ npm install firebaseui-angular --save

To run this library you need to have AngularFire2, Firebase, FirebaseUI-Web installed. Fast install:

$ npm install firebase firebaseui @angular/fire firebaseui-angular --save

How to use

Add the FirebaseUIModule with the config to your imports. Make sure you have initialized AngularFire correctly.

import {BrowserModule} from '@angular/platform-browser';
import {NgModule} from '@angular/core';
import {FormsModule} from '@angular/forms';
import {AppComponent} from './app.component';
import {firebase, firebaseui, FirebaseUIModule} from 'firebaseui-angular';
import {environment} from '../environments/environment';
import {AppRoutingModule} from './app-routing.module';
import {AngularFireModule} from '@angular/fire';
import {AngularFireAuthModule, USE_EMULATOR as USE_AUTH_EMULATOR} from '@angular/fire/auth';


const firebaseUiAuthConfig: firebaseui.auth.Config = {
  signInFlow: 'popup',
  signInOptions: [
    firebase.auth.GoogleAuthProvider.PROVIDER_ID,
    {
      scopes: [
        'public_profile',
        'email',
        'user_likes',
        'user_friends'
      ],
      customParameters: {
        'auth_type': 'reauthenticate'
      },
      provider: firebase.auth.FacebookAuthProvider.PROVIDER_ID
    },
    firebase.auth.TwitterAuthProvider.PROVIDER_ID,
    firebase.auth.GithubAuthProvider.PROVIDER_ID,
    {
      requireDisplayName: false,
      provider: firebase.auth.EmailAuthProvider.PROVIDER_ID
    },
    firebase.auth.PhoneAuthProvider.PROVIDER_ID,
    firebaseui.auth.AnonymousAuthProvider.PROVIDER_ID
  ],
  tosUrl: '<your-tos-link>',
  privacyPolicyUrl: '<your-privacyPolicyUrl-link>',
  credentialHelper: firebaseui.auth.CredentialHelper.GOOGLE_YOLO
};

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    FormsModule,
    AppRoutingModule,
    AngularFireModule.initializeApp(environment.firebaseConfig),
    AngularFireAuthModule,
    FirebaseUIModule.forRoot(firebaseUiAuthConfig)
  ],
  providers: [
    { provide: USE_AUTH_EMULATOR, useValue: !environment.production ? ['localhost', 9099] : undefined },
  ],
  bootstrap: [AppComponent]
})
export class AppModule {
}




Add the firebaseui css to your imports:

Option 1: CSS Import

May be incompatible with older browsers.

Import the firebaseui css to your src/styles.css file:

@import '~firebaseui/dist/firebaseui.css';

Option 2: Angular-CLI

File: angular.json

Path: "node_modules/firebaseui/dist/firebaseui.css"

{
  "projects": {
    [your-project-name]: {
      ...
      "architect": {
        "build": {
          "options": {
            ...
            "styles": [
              "src/styles.css",
              "node_modules/firebaseui/dist/firebaseui.css"
            ]
          }
        },
        ...
        "test": {
          "options": {
            ...
            "styles": [
              "src/styles.css",
              "node_modules/firebaseui/dist/firebaseui.css"
            ]
          }
        }
      }
    }
  }
}

Option 3: HTML Link

Put this in the <head> tag of your index.html file:

<link type="text/css" rel="stylesheet" href="https://cdn.firebase.com/libs/firebaseui/3.0.0/firebaseui.css" />

Make sure the version number matches the version of firebaseui you have installed with npm.

Once everything is set up, you can use the component in your Angular application:

<firebase-ui></firebase-ui>

Configuration

For the configuration of the module see the official firebaseui documentation: Config

If you use a version prior to 3.3.0 check the old README

forRoot/forFeature

To configure the plugin the first time (main.module.ts) the forRoot() method is used. It builds the basis for all further uses of the plugin. But you have the possibility to overwrite the entire or just parts of the configuration in any (sub-)module.

forRoot

To overwrite the entire configuration use:

FirebaseUIModule.forRoot(firebaseUiAuthConfig: NativeFirebaseUIAuthConfig)
forFeature

To overwrite just parts of the configuration use:

FirebaseUIModule.forFeature(firebaseUiAuthConfig: NativeFirebaseUIAuthConfig)

This will use the in forRoot provided configuration and overwrite just the newly provided values.

Listen to auth state changes

this.angularFireAuth.authState.subscribe(this.firebaseAuthChangeListener);

private firebaseAuthChangeListener(response) {
    // if needed, do a redirect in here
    if (response) {
      console.log('Logged in :)');
    } else {
      console.log('Logged out :(');
    }
  }

Don't forget to unsubscribe at the end.

Sign-in success / failure callbacks

<firebase-ui
    (signInSuccessWithAuthResult)="successCallback($event)"
    (signInFailure)="errorCallback($event)"
    (uiShown)="uiShownCallback()"></firebase-ui>
successCallback(signInSuccessData: FirebaseUISignInSuccessWithAuthResult) {
    ...
}

errorCallback(errorData: FirebaseUISignInFailure) {
    ...
}

uiShownCallback() {
    ...
}

Disable auto sign-in

constructor(private firebaseuiAngularLibraryService: FirebaseuiAngularLibraryService) {
  firebaseuiAngularLibraryService.firebaseUiInstance.disableAutoSignIn();
}

Internationalizaion (i18n)

The internationalization with just the npm package of the official firebase-ui isn't possible at the moment.

For a custom version with i18n support use: l0ll098/FirebaseUI-Angular-i18n

Thanks to @l0ll098!

Contributing / Sample Application

Step 1: Fork and clone the repo from Github.

Step 2: There is a sample project in the root folder. Execute the following command in the root folder i.e. .../FirebaseUI-Angular > npm install

Step 3: Ensure that you are using Angular CLI version >10. You can check your version with ng --version in the terminal.

Step 4: Replace with your firebase config in src\environments\environment.ts.

Step 5: .../FirebaseUI-Angular > npm run build-lib

Step 6: .../FirebaseUI-Angular > ng serve

You're welcome to fork the repo and contribute to library sources in projects > firebaseui-angular-library > src > lib.

There are test files, but they are empty at the moment. Writing unit test is a good start.

Troubleshoot

UI not rendered

The UI only gets rendered if the user isn't signed in. So if the UI isn't shown, sign out the user via angular-fire.

Prod build error

ERROR in ./src/app/app.module.ngfactory.js
Module not found: Error: Can't resolve 'firebase/index' in '...'
ERROR in ./src/app/app.module.ngfactory.js
Module not found: Error: Can't resolve 'firebaseui/dist/index' in '...'

Use the firebase and firebaseui instances exposed by the plugin:

import {..., firebase, firebaseui} from 'firebaseui-angular';

CSS not loaded

If you have added the css to the angular.json but nothing happened. Try to restart the server (Ctrl-C and ng serve)

ERROR in ./~/firebase/app/shared_promise.js

This is a know issue in the firebase project. To fix that (for now), do that:

npm install promise-polyfill --save-exact

http://localhost:4200/images/buffer.svg?embed 404 (Not Found)

Put this into your styles.scss file:

@supports (-webkit-appearance:none) {
  .mdl-progress:not(.mdl-progress--indeterminate):not(.mdl-progress--indeterminate) > .auxbar,
  .mdl-progress:not(.mdl-progress__indeterminate):not(.mdl-progress__indeterminate) > .auxbar {
    mask: url(/assets/images/buffer.svg?embed) !important;
  }
}

and put a buffer.svg file into assets/images. This will stop this error message.

License

MIT © Raphael Jenni

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].