本文整理汇总了TypeScript中firebase.auth函数的典型用法代码示例。如果您正苦于以下问题:TypeScript auth函数的具体用法?TypeScript auth怎么用?TypeScript auth使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了auth函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
response => {
this.router.navigate(['/']);
firebase.auth().currentUser.getIdToken()
.then(
(token: string) => {
this.token = token;
}
);
}
示例2: signupUser
signupUser(email: string, password: string): Promise<any> {
return firebase.auth().createUserWithEmailAndPassword(email, password)
.then(newUser => {
firebase.database().ref('/userProfile').child(newUser.uid)
.set({ email: email });
});
}
示例3: getToken
getToken() {
firebase.auth().currentUser.getIdToken()
.then(
(token: string) => {
this.token = token;
}
);
return this.token;
}
示例4:
response => {
this.router.navigate(['/']);
// firebase.auth().currentUser.getToken()
firebase.auth().currentUser.getIdToken()
.then(
(token: string) => this.token = token
);
this.alertService.showToaster('Login succesful');
}
示例5: createProduct
createProduct(event) {
event.preventDefault();
let self = this;
self.loading = Loading.create({
// message: "processing..."
});
this.nav.present(self.loading);
var userId = firebase.auth().currentUser.uid;
firebase.database().ref('/userProfile/' + userId).once('value').then(function(snapshot) {
var timestamp = (new Date()).getTime();
var product = {
seller_id: userId,
seller_name: snapshot.val().name,
seller_image: snapshot.val().image,
seller_email: snapshot.val().email,
name: self.productForm.value.name,
tagline: self.productForm.value.tagline,
price: self.productForm.value.price,
description: self.productForm.value.description,
image: self.imgURI,
created_at: timestamp,
updated_at: timestamp
};
self.Products.createProduct(product).then((data) => {
console.log("success:", data);
self.loading.dismiss().then(function(){
self.toast = Toast.create({
message: "Create product success!",
duration: 1000,
position: 'bottom'
});
self.nav.present(self.toast);
});
// self.nav.Tab.setSelected(1);
}, (error) => {
console.log("failed:", error);
self.loading.dismiss().then(function(){
self.toast = Toast.create({
message: "Create product failed!",
duration: 1000,
position: 'bottom'
});
self.nav.present(self.toast);
});
})
});
// var current_user = this.authData.getCurrentUser();
// console.log("current_user:", current_user);
}
示例6: facebookLogin
facebookLogin(): any {
firebase.auth().signInWithPopup(this.facebookAuth).then(function (result) {
console.log(result);
console.log("Facebook Login");
}).catch(function (error) {
console.log("Facebook Login Error");
console.log(error);
});
}
示例7: isAuthenticated
isAuthenticated()
{
const user = firebase.auth().currentUser;
if(user)
{
return true;
}
return false;
}
示例8: inicioSesion
inicioSesion(userdata)
{
firebase.auth().signInWithEmailAndPassword(userdata.email,userdata.password)
.then( resp => {
console.log(resp);
this.router.navigate(['/inicio']);
}).catch( error => {
console.log(error);
})
}
示例9:
response => {
this.store.dispatch(new AuthActions.Signin());
this.router.navigate(['/']);
firebase.auth().currentUser.getToken()
.then(
(token: string) => {
this.store.dispatch(new AuthActions.SetToken(token));
}
)
}