【问题标题】:Firebase Phone Number authentication in Chrome ExtensionChrome 扩展中的 Firebase 电话号码身份验证
【发布时间】:2018-05-26 04:16:15
【问题描述】:

有可能吗? 我在https://firebase.google.com/docs/auth/web/phone-auth 上读了一点,但它一直提到OAuth redirect domains,不确定chrome 扩展域是否对此有效?

【问题讨论】:

  • 您可以添加任何详细信息,例如:使用的代码,遇到的错误问题吗? How do I ask a good question?, How to create a Minimal, Complete, and Verifiable example 向社区展示你的尝试。
  • @noogui 不,我仍处于决定我是否会走这条路的阶段,这就是为什么我在这里要求获得一些见解,因为我不想投入几天时间开发这个只是走到了死胡同,因为它不可能使用
  • 它们不是,因为 reCAPTCHA 在 chrome 扩展环境中无法正常工作(它不处理 chrome 扩展域)

标签: firebase google-chrome-extension oauth oauth-2.0 firebase-authentication


【解决方案1】:

它们不适用于 chrome 扩展程序,但您可以在网页中呈现 reCAPTCHA 验证器,获取验证 ID 和代码,然后使用 postMessage 之类的方式将其传递给您的 chrome 扩展程序,然后通过您的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.
  });

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-01-28
    • 1970-01-01
    • 2021-06-11
    • 1970-01-01
    • 1970-01-01
    • 2021-04-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多