AsifArmanRahman / firebase-rest-api

A simple python wrapper for Google's Firebase REST API's.
https://firebase-rest-api.readthedocs.io
MIT License
60 stars 14 forks source link

Need the current_user #31

Closed furjac closed 9 months ago

furjac commented 9 months ago

Is your proposal related to a problem?

I'm unable to use user = auth.current_user like we can get many things out of it you only use signin with email and password as user but I can't use it everywhere u understand I think add this feature plz

Describe the solution you'd like.

User = Auth.current_user
This is what needed

Describe alternatives you've considered.

No response

Additional context.

No response

github-actions[bot] commented 9 months ago

Hello @furjac , thank you for submitting an issue! A project committer will shortly review the issue.

Lxstr commented 9 months ago

You need to use a session management tool such as flask-session. This is out of scope for this repo.

furjac commented 9 months ago

@Lxstr see i build cli tools yep cli i used pyrebase it was fine working but the problem is email verification link was not coming correctly thats why i came here but here auth.current_user not working but as u said it needs flask no it doesnt pyrebase worked fine without flask or anything

AsifArmanRahman commented 9 months ago

current_user property was dropped because of security vulnerability, and it will not be supported. If current_user property is used, it'll provide access of one logged in user to every other user, because the creds/token is stored as an object attribute value, which is not specific to each user separately.

furjac commented 9 months ago

yea i see and i found a solution correct me if im wrong @AsifArmanRahman

def signUp():
    clear()
    print('Signup menu')
    email = input("Enter your email address: ")
    password = input("Enter Your password: ")
    try:
        user_info = auth.create_user_with_email_and_password(email, password)
        print("Successfully signed up")
        user_id_token = user_info['idToken']

        auth.send_email_verification(user_id_token)

        logIn()
    except Exception as e:
        print(f"Error during signup: {e}")
    is this ok
AsifArmanRahman commented 9 months ago

Yeah it seems fine. I thought you needed that generic auth.current_user to be used everywhere else, thus @Lxstr mentioned session management tools. But if your need only applies to per case, it'll work fine.

furjac commented 9 months ago

i still have this doubt

def main_menu():
    clear()
    print('Welcome to FG SMM Panel || by Furjack')
    print(f'Signed in as{user_info_['email']}')
    print('\n1. otpion)
    print('2. option)
    print('3. option)
    print('4. option )
    print('5. Exit')

here how do i get the email this function is seperate i tried global it doesnt work