[Python] Firestore missing or insufficient permission firebase-rest-api Python

Discussão em 'Python' iniciado por Stack, Julho 30, 2025.

  1. Stack

    Stack Membro Participativo

    I'm getting this error only when the database rule is set to:

    rules_version = '2';
    service cloud.firestore {
    match /databases/{database}/documents {
    match /{document=**} {
    allow read, write: if request.auth != null;
    }
    }
    }


    and if I use this rule:

    rules_version = '2';
    service cloud.firestore {
    match /databases/{database}/documents {
    match /{document=**} {
    allow read, write;
    }
    }
    }


    This works, but there are too many security risks so I decided to use the first one but in my coding am I doing something wrong:

    #initialization
    app = firebase.initialize_app(firebaseConfig)
    auth = app.auth()
    db = app.firestore()

    #signup method

    def signUp():
    clear()
    print('Signup menu')
    print('Never forget your password or email; you will lose all your credits.\nIf this happens, contact furjack')
    email = input("Enter your email address: ")
    password = input("Enter your password: ")

    try:
    user_info = auth.create_user_with_email_and_password(email, password)
    user_id_token = user_info['idToken']

    user_wallet_ref = db.collection('users-wallet').document(email)
    user_wallet_ref.set({'wallet': 0})

    print("Successfully signed up")
    auth.send_email_verification(user_id_token)
    print('We have sent you a verification email. Please verify your email to use the app.')

    input('Press enter to continue...')

    logIn()
    except:
    print(f"Error during signup")
    input('Press enter to continue...')
    exit()


    This is it basically where am I doing wrong or is Google wrong or what is wrong?

    Continue reading...

Compartilhe esta Página