firebase - Chrome 扩展中的 Firebase 电话号码身份验证
问题描述
可能吗?我在https://firebase.google.com/docs/auth/web/phone-auth上读了一点,但它一直提到OAuth redirect domains
,不确定 chrome 扩展域是否对此有效?
解决方案
它们不适用于 chrome 扩展程序,但您可以在网页中呈现 reCAPTCHA 验证程序,获取验证 ID 和代码并将其传递给您的 chrome 扩展程序postMessage
,然后使用以下方式通过您的 chrome 扩展程序登录:
// You get verificationId from reCAPTCHA rendered on web page.
// You ask the user to provide the 6 digit code.
var cred = firebase.auth.PhoneAuthProvider.credential(verificationId, code);
firebase.auth().signInWithCredential(cred)
.then(function(result) {
// User signed in.
})
.catch(function(error) {
// Error occurred.
});
推荐阅读
- java - 字段 jdbcTemplate 需要找不到类型为“org.springframework.jdbc.core.JdbcTemplate”的 bean
- logback - 如何通过 App Engine Standard (Java) 在 Logback 上使用 jsonPayload?
- continuous-integration - wercker 中的链式管道(默认执行)不会产生结果
- c - 宏 - 生成 4 位查找表
- c++ - 调暗 vscode 中未使用的变量
- angular - 未捕获的错误:无法解析 HacksStorageService 的所有参数:([object Object],?)。在语法错误
- html - 为整个页面添加噪音
- reactjs - 找不到变量:React Native 的 react-native-material-bottom-navigation 中的选项卡
- c# - NHibernate如何将外键关系映射到多个属性
- python - 了解 Python 堆栈中的递归