本文整理汇总了TypeScript中angularfire2.FirebaseAuth类的典型用法代码示例。如果您正苦于以下问题:TypeScript FirebaseAuth类的具体用法?TypeScript FirebaseAuth怎么用?TypeScript FirebaseAuth使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FirebaseAuth类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(public auth$: FirebaseAuth) {
this.authState = auth$.getAuth();
auth$.subscribe((state: FirebaseAuthState) => {
this.authState = state;
});
}
示例2: constructor
constructor( private auth$: FirebaseAuth) {
// / this.authState = auth$.getAuth();
auth$.subscribe((state: FirebaseAuthState) => {
this.authState = state;
console.log(this.authState);
});
}
示例3: constructor
constructor(private _af: AngularFire, private _auth: FirebaseAuth) {
this._auth.subscribe(authData => {
if (authData) {
this._mealPlans = _af.database.list(`/meal-plans/${authData.uid}`);
}
});
}
示例4: init
public init() {
// subscribe to the auth object to check for the login status
// of the user, if logged in, save some user information and
// execute the firebase query...
// .. otherwise
// show the login modal page
this.auth.subscribe((data) => {
console.log("in sam.auth.service subscribe ", JSON.stringify(data))
if (data) {
if (data.twitter) {
this.authInfo = data.twitter;
this.authInfo.displayName = data.twitter.displayName;
} else if (data.github) {
this.authInfo = data.github;
this.authInfo.displayName = data.github.displayName;
} else if (data.google) {
this.authInfo = data.google;
this.authInfo.displayName = data.google.displayName;
} else {
this.authInfo = data.password;
this.authInfo.displayName = data.password.email;
}
this.authInfo.uid = data.uid;
} else {
this.authInfo = null;
}
})
}
示例5: loginTwitter
loginTwitter() {
this.auth.login({
provider: AuthProviders.Twitter
}).then(() => {
this.nav.setRoot(ChatPage);
});
}
示例6: login
login(credentials) {
let loading = Loading.create({
content: "Por favor aguarde..."
});
this.navCtrl.present(loading);
this.auth.login(credentials, {
provider: AuthProviders.Password,
method: AuthMethods.Password
}).then((authData) => {
console.log(authData);
loading.dismiss();
this.navCtrl.popToRoot();
}).catch((error) => {
loading.dismiss();
if (error) {
switch (error.code) {
case "INVALID_EMAIL":
this.error = "E-mail invรกlido.";
break;
case "INVALID_USER":
this.error = "E-mail ou senha incorretos.";
break;
case "INVALID_PASSWORD":
this.error = "E-mail ou senha incorretos.";
break;
case "NETWORK_ERROR":
this.error = "Aconteceu algum erro ao tentar se conectar ao servidor, tente novamente mais tarde.";
break;
default:
this.error = error;
}
}
});
}
示例7: _login
private _login(authType: AuthProviders) {
this.firebaseAuth.login({
provider: authType
}).then((authData: any) => {
authData.auth.token.firebase = null; // remove array
this.angularFire.object('/users/' + authData.uid + '/authData').set(authData);
}).catch(err => console.log('Login Failed', err));
}
示例8:
ngOnInit() {
this.auth.subscribe((data) => {
console.log("in auth subscribe", data)
if (data) {
this.nav.setRoot(BulletinBoardPage);
}
});
}
示例9: ngOnInit
ngOnInit(): void {
this._auth.subscribe(authData => {
if (authData) {
this.username = authData.auth.displayName;
this.userImage = authData.auth.photoURL;
}
});
}
示例10: loginUser
loginUser(email:string, password:string):Promise<any>{
return this.auth.login({
email: email,
password: password
})
.then(user => Promise.resolve( user ))
.catch(error => Promise.reject( error ));
}