Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angularfire 2 Error: The specified authentication provider is not enabled for this Firebase

I am creating a simple sample auth app with Ionic 2 and angularfire 2 as backend, when i try to create new user it says:

EXCEPTION: Error: Uncaught (in promise): Error: The specified authentication provider is not enabled for this Firebase.

But i already enabled firebase authentication in firebase console:enter image description here

app.ts

import {App, Platform} from 'ionic-angular';
import {StatusBar} from 'ionic-native';
import {HomePage} from './pages/home/home';
import { FIREBASE_PROVIDERS, defaultFirebase, firebaseAuthConfig, AuthProviders, AuthMethods } from 'angularfire2';

@App({
  template: '<ion-nav [root]="rootPage"></ion-nav>',
  providers: [
    FIREBASE_PROVIDERS,
    defaultFirebase('https://samplequizapp-50eb5.firebaseio.com'),
    firebaseAuthConfig({
      provider: AuthProviders.Password,
      method: AuthMethods.Password
    })
  ],
  config: {} // http://ionicframework.com/docs/v2/api/config/Config/
})
export class MyApp {
  rootPage: any = HomePage;

  constructor(platform: Platform) {
    platform.ready().then(() => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      StatusBar.styleDefault();
    });
  }
}

home.ts

import { Page } from 'ionic-angular';
import { AngularFire, FirebaseListObservable } from 'angularfire2';
import { OnInit } from '@angular/core'

@Page({
  templateUrl: 'build/pages/home/home.html'
})
export class HomePage implements OnInit {
  user: any = {};
  data: FirebaseListObservable<any[]>;

  constructor(private af: AngularFire) {
  }

  ngOnInit() {
    this.data = this.af.database.list('/userId')
  }

  signUp(data) {
    this.af.auth.createUser({
      email: data.email,
      password: data.password
    })
  }

}

I am pretty sure there is nothing wrong with my code:

like image 394
Aamir shah Avatar asked Dec 10 '22 16:12

Aamir shah


1 Answers

Firebase2 in its current version (2.4.2) is not yet compatible with Firebase SDK v3, and all projects created with the new Firebase console are only accessible with calls comaptible with SDK v3.

You want to create your Firebase backend in the legacy console www.firebase.com first, and then migrate to the new console.

This is documented in this closed issue of the angularfire2 github: https://github.com/angular/angularfire2/issues/189

like image 162
benblass Avatar answered Dec 28 '22 15:12

benblass