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

Added anonymous sign-in support #398

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pyrebase/pyrebase.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ def sign_in_with_email_and_password(self, email, password):
self.current_user = request_object.json()
return request_object.json()

def sign_in_anonymously(self):
request_ref = "https://identitytoolkit.googleapis.com/v1/accounts:signUp?key={0}".format(self.api_key)
response = requests.post(request_ref, json={'returnSecureToken': True})
self.current_user = response.json()
return response.json()

def create_custom_token(self, uid, additional_claims=None):
service_account_email = self.credentials.service_account_email
private_key = RSA.importKey(self.credentials._private_key_pkcs8_pem)
Expand Down