本文整理汇总了TypeScript中angularfire2.AngularFireAuth类的典型用法代码示例。如果您正苦于以下问题:TypeScript AngularFireAuth类的具体用法?TypeScript AngularFireAuth怎么用?TypeScript AngularFireAuth使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AngularFireAuth类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: loginWithEmail
loginWithEmail(email, password) {
return this.auth.login({
email: email,
password: password,
},
{
provider: AuthProviders.Password,
method: AuthMethods.Password,
});
}
示例2: angularFireAuth
private angularFireAuth(accessToken) {
let creds = firebase.auth.FacebookAuthProvider.credential(accessToken);
this.auth.login(creds, {provider: AuthProviders.Facebook, method: AuthMethods.OAuthToken})
.then((auth: FirebaseAuthState) => {
this.toastService.show('TOAST_SIGNED_IN');
const data = auth.auth;
const facebookUid = data['providerData'][0].uid;
this.af.database.object(`/users/${auth.uid}`).update({
image: `http://graph.facebook.com/${facebookUid}/picture?type=large`,
email: data.email,
name: data.displayName
});
})
.catch((error) => {
alert("Firebase failure: " + JSON.stringify(error));
});
}
示例3: constructor
constructor(private af: AngularFire) {
this.auth = af.auth;
this.user = this.auth
.filter(auth => auth !== null)
.map(auth => AluecoUser.fromAuthSession(auth));
}
示例4: loginWithGoogle
loginWithGoogle(): firebase.Promise<FirebaseAuthState> {
return this.auth.login({
provider: AuthProviders.Google,
method: AuthMethods.Popup,
});
}
示例5: createAuthUser
createAuthUser(user: { email: string, password: string }): firebase.Promise<FirebaseAuthState> {
return this.auth.createUser(user)
.catch(this.handlePromiseError);;
}