Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[update] if don't have a apiKey, get the key from serviceAccount.json #441

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gabriel-batistuta
Copy link

@gabriel-batistuta gabriel-batistuta commented Apr 20, 2023

this code allow get the private_key from serviceAccount.json if don't have a apiKey

hello, as it says in issue #98, a user could authenticate with just the serviceAccount.json file, so I made this small change in the code so that if you don't have an api key in config then look in the file serviceAccount.json the api key

changes:

class Firebase:
    """ Firebase Interface """
    def __init__(self, config):
        if config.get("apiKey"):
            self.api_key = config["apiKey"]
        else:
            with open(config["serviceAccount"],'r') as file:
                data = file.read()
                self.api_key = json.loads(data)["private_key"]

@gabriel-batistuta gabriel-batistuta changed the title if don't have a apiKey, get the key from serviceAccount.json [update] if don't have a apiKey, get the key from serviceAccount.json May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant