本文整理汇总了TypeScript中firebase-admin.auth函数的典型用法代码示例。如果您正苦于以下问题:TypeScript auth函数的具体用法?TypeScript auth怎么用?TypeScript auth使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了auth函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: getAllUsers
/**
* Get a list of users
*
* @param {number} [maxResults=1000]
* @returns {Promise<any>}
* @memberof FirebaseHelper
*/
getAllUsers(maxResults: number = 1000): Promise<any> {
return admin.auth().listUsers(maxResults)
.then((listUsersResult) => listUsersResult.users)
.catch((error) => {
console.log("Error listing users:", error);
});
}
开发者ID:ansidev,项目名称:firebase-functions-helper,代码行数:14,代码来源:firebase.ts
示例2:
.firestore.document('/users/{userId}').onDelete((change, context) => {
// console.log(change.after.data());
// console.log(context.params.userId);
const userId: string = context.params.userId;
return admin.auth().deleteUser(userId);
});
开发者ID:Meistercoach83,项目名称:sfw,代码行数:9,代码来源:user-deleted.ts
示例3: Promise
return new Promise(resolve => {
admin.auth().deleteUser(userId)
.then(() => {
resolve(true);
})
.catch(error => {
console.log(error);
resolve(false);
})
})
开发者ID:ansidev,项目名称:firebase-functions-helper,代码行数:10,代码来源:firebase.ts
示例4:
.catch(err => {
if (err.message === 'The user with the provided uid already exists.') {
return admin.auth().updateUser('uchicago:' + uid, {
displayName,
email,
emailVerified: true,
});
}
throw err;
});
开发者ID:kevmo314,项目名称:canigraduate.uchicago.edu,代码行数:10,代码来源:Users.ts
示例5: getToken
static async getToken({ uid, displayName, email }: User): Promise<string> {
await admin
.auth()
.createUser({
uid: 'uchicago:' + uid,
displayName,
email,
emailVerified: true,
})
.catch(err => {
if (err.message === 'The user with the provided uid already exists.') {
return admin.auth().updateUser('uchicago:' + uid, {
displayName,
email,
emailVerified: true,
});
}
throw err;
});
return admin.auth().createCustomToken('uchicago:' + uid);
}
开发者ID:kevmo314,项目名称:canigraduate.uchicago.edu,代码行数:21,代码来源:Users.ts
示例6: create
static async create(uid, displayName, email) {
await admin
.auth()
.createUser({
uid,
displayName,
email,
emailVerified: true,
})
.catch(err => {
if (err.message === 'The user with the provided uid already exists.') {
return admin.auth().updateUser(uid, {
displayName,
email,
emailVerified: true,
});
}
throw err;
});
return admin.auth().createCustomToken(uid);
}
开发者ID:kevmo314,项目名称:canigraduate.uchicago.edu,代码行数:21,代码来源:Users.ts
示例7:
.firestore.document('/users/{userId}').onUpdate((change, context) => {
// console.log(change.after.data());
// console.log(context.params.userId);
const data: any = change.after.data();
const userId: string = context.params.userId;
return admin.auth().updateUser(userId, {
disabled: data.isDisabled
});
});
开发者ID:Meistercoach83,项目名称:sfw,代码行数:13,代码来源:user-disabled.ts
示例8: getUserByPhone
/**
* Get User Info though phone number
*
* @param {string} phone
* @returns {Promise<any>}
* @memberof FirebaseHelper
*/
getUserByPhone(phone: string): Promise<any> {
return admin.auth().getUserByPhoneNumber(phone)
.then(user => user)
.catch(error => console.log(error))
}
开发者ID:ansidev,项目名称:firebase-functions-helper,代码行数:12,代码来源:firebase.ts
示例9: getUserByEmail
/**
* Get User Info though email
*
* @param {string} email
* @returns {Promise<any>}
* @memberof FirebaseHelper
*/
getUserByEmail(email: string): Promise<any> {
return admin.auth().getUserByEmail(email)
.then(user => user)
.catch(error => console.log(error))
}
开发者ID:ansidev,项目名称:firebase-functions-helper,代码行数:12,代码来源:firebase.ts
注:本文中的firebase-admin.auth函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论