gpt4 book ai didi

Angular 火 2 错误 : The specified authentication provider is not enabled for this Firebase

转载 作者:太空狗 更新时间:2023-10-29 17:42:44 25 4
gpt4 key购买 nike

我正在使用 Ionic 2 和 angularfire 2 作为后端创建一个简单的示例身份验证应用程序,当我尝试创建新用户时,它说:

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

但我已经在 firebase 控制台中启用了 firebase 身份验证: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
})
}

}

我很确定我的代码没有问题:

最佳答案

当前版本 (2.4.2) 中的 Firebase2 尚不兼容 Firebase SDK v3,使用新 Firebase 控制台创建的所有项目只能通过与 SDK v3 兼容的调用访问。

您想在旧控制台中创建 Firebase 后端 www.firebase.com首先,然后迁移到新控制台。

这记录在 angularfire2 github 的这个已关闭问题中:https://github.com/angular/angularfire2/issues/189

关于 Angular 火 2 错误 : The specified authentication provider is not enabled for this Firebase,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37481731/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com