4
firebase의 AngularFire2를 사용하여 페이스 북 인증을 시도하고 있습니다. 이 자습서와 완전히 동일한 단계를 수행합니다. github.com/angular/angularfire2/blob/master/docs/Auth-with-Ionic2.md'authState'속성이 ionic 2 앱의 'AngularFireAuth'유형에 존재하지 않습니다.
하지만 어떤 이유로 든 작동하지 않습니다. 그것은 내 제공자의 페이지에서 많은 오류를 제공합니다. 여기 내 코드가있다.
import { Injectable } from '@angular/core';
import { Component } from '@angular/core';
import { Http } from '@angular/http';
import 'rxjs/add/operator/map';
import { Observable } from 'rxjs/Observable';
import { AngularFireAuth } from 'angularfire2/auth';
import * as firebase from 'firebase/app';
@Injectable()
export class AuthService {
private authState: Observable<firebase.User>;
private currentUser: firebase.User;
constructor(public http: Http, public afAuth: AngularFireAuth) {
console.log('Hello AuthService Provider');
this.authState = afAuth.authState; //First error here.
afAuth.subscribe((user: firebase.User) => { //second here
this.currentUser = user;
});
}
get authenticated(): boolean {
return this.currentUser !== null;
}
signInWithFacebook(): firebase.Promise<any> {
return this.afAuth.auth.signInWithPopup(new firebase.auth.FacebookAuthProvider()); //third error here
}
signOut(): void {
this.afAuth.signOut();
}
displayName(): string {
if (this.currentUser !== null) {
return this.currentUser.facebook.displayName;
} else {
return '';
}
}
}
오류
Property 'auth' does not exist on type 'AngularFireAuth'.
Property 'authState' does not exist on type 'AngularFireAuth'.
Argument of type '(user: User) => void' is not assignable to parameter of type '(value: FirebaseAuthState) => void'.
Types of parameters 'user' and 'value' are incompatible.
Type 'FirebaseAuthState' is not assignable to type 'User'.
Property 'delete' is missing in type 'FirebaseAuthState'.
내가 각도 및 이온 꽤 새로운 오전, 여기에 나를 인도, 또는 좋은 자습서에 저를 탐색하십시오