程序问答   发布时间:2022-06-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了firebase error Uncaught (in promise) FirebaseError: 权限缺失或不足大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决firebase error Uncaught (in promisE) FirebaseError: 权限缺失或不足?

开发过程中遇到firebase error Uncaught (in promisE) FirebaseError: 权限缺失或不足的问题如何解决?下面主要结合日常开发的经验,给出你关于firebase error Uncaught (in promisE) FirebaseError: 权限缺失或不足的解决方法建议,希望对你解决firebase error Uncaught (in promisE) FirebaseError: 权限缺失或不足有所启发或帮助;

我正在尝试使用我的 react 应用程序实现条带支付系统,我在其中使用 firebase 来存储用户数据。我从另一位开发人员那里接手了项目,但在尝试获取用户的 uID 以将信息连接在一起时遇到了问题。

我在运行 checkout.Js 页面时收到错误 Uncaught (in promisE) FirebaseError: Missing or insufficIEnt permissions....这是我所拥有的:

user.Js

    class UserStripe {
    constructor({ db,auth,firestoreEnvironment }) {
      this.db = db
      this.auth = auth
      this.collections = new StripeCollectionUtil({ db,firestoreEnvironment,auth })
      this.env = firestoreEnvironment
    }
  
    docreateuser(uID,email,name,companyName) {
      if (!companyName) companyname = null
      return this.collections.getCollectionFor('users').doc(uID).set({
        email,companyname,areasAndTasks: JsON.Stringify(defaultAreasAndTasks),environment: this.env
      })
    }
  
    getUserProfile() {
      let uID = this.auth.currentUser.uID
      return this.collections.getCollectionFor('users').doc(uID).get().then(doc => doc.data())
    }
  
    getAreasAndTasks() {
      return this.getUserProfile().then((userProfilE) => JsON.parse(userProfile.areasAndTasks))
    }
  }
  
  module.exports = UserStripe

这是我的 checkout.Js

    import firebase from 'firebase';
import getStripe from './Stripe';

const firestore = firebase.firestore();

export async function createcheckoutSession(){

    // without uID
    
    // return firestore.collection()
    const checkoutSessionRef =  await firestore.collection('customers').doc().collection('checkout_sessions').add(
        
        {price : 'price_1IGEdTKDPaWWeL1ymwWH5Ubb',success_url : window.LOCATIOn.origin,cancel_url: window.LOCATIOn.origin,}
    );

    checkoutSessionRef.onSnapshot(async (snap) => {
        const {sessionID} = snap.data();
        if (sessionID) {
             const Stripe = await getStripe()
             Stripe.redirecttocheckout({sessionID})
        }
    });
}

如何将 uID 导入结帐页面,以免出现此错误?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

大佬总结

以上是大佬教程为你收集整理的firebase error Uncaught (in promise) FirebaseError: 权限缺失或不足全部内容,希望文章能够帮你解决firebase error Uncaught (in promise) FirebaseError: 权限缺失或不足所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。