firebase - 我如何使用云功能注册 Firebase?
问题描述
我正在学习使用云功能,并且可以使用该方法创建用户admin.auth().createUser
,但现在我想用谷歌帐户注册
我尝试使用admin.auth().GoogleAuthProvider()
但告诉我GoogleAuthProvider()
不存在
解决方案
并不总是可以使用 admin sdk。例如,我正在使用 Google Actions,并且已经解决了 firebase 依赖项(npm i --save firebase)。 https://firebase.google.com/docs/auth/web/google-signin?hl=es-419
async function createUser(token: string) {
// Build Firebase credential with the Google ID token.
const credential = firebase.auth.GoogleAuthProvider.credential(token);
const userCredential = await firebase.auth().signInWithCredential(credential);
}
推荐阅读
- kotlin - 将 InputStream 转换为流
- javascript - 有没有办法防止后退按钮覆盖localStorage?
- python - Tkinter - 在扩展窗口大小时更改按钮位置
- javascript - 如何在 React 中对状态更改进行 API 调用?
- python - 从 Tensorflow 2.0 导出 pb 文件以与 C API 一起使用
- excel - VLOOKUP 比较两列
- java - 如何在 Android Studio 中为后端服务生成 jar?
- python - 有人可以告诉我这种解决三序列最长公共子序列问题的方法是否正确
- c++ - 没有类型,结构绑定不起作用?
- java - .\classes\Student.java:5:错误:无法访问 IStudentOperations 公共类学生实现 IStudentOperations