本文整理匯總了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);;
}