Skip to content

Commit be6cb05

Browse files
feat(auth): Sign In with Google
1️⃣ 𝘢𝘶𝘵𝘩𝘦𝘯𝘵𝘪𝘤𝘢𝘵𝘦_𝘭𝘰𝘨𝘪𝘯_𝘸𝘪𝘵𝘩_𝘨𝘰𝘰𝘨𝘭𝘦 method brings google sign in feature to 𝘼𝙪𝙩𝙝 class.
1 parent e444135 commit be6cb05

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

firebase/auth/__init__.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ def __init__(self, api_key, credentials, requests, client_secret=None):
5353
if client_secret:
5454
self.client_secret = _load_client_secret(client_secret)
5555

56+
def authenticate_login_with_google(self):
57+
""" Redirect the user to Google's OAuth 2.0 server to initiate
58+
the authentication and authorization process.
59+
60+
:return: Google Sign In URL
61+
:rtype: str
62+
"""
63+
return self.create_authentication_uri('google.com')
64+
5665
def create_authentication_uri(self, provider_id):
5766
""" Creates an authentication URI for the given social
5867
provider.
@@ -531,6 +540,10 @@ def _load_client_secret(secret):
531540
""" Load social providers' client secret from file if file path
532541
provided.
533542
543+
This function also restructures the dict object to make it
544+
compatible for usage.
545+
546+
534547
:type secret: str or dict
535548
:param secret: File path to or the dict object from social client
536549
secret file.
@@ -543,4 +556,8 @@ def _load_client_secret(secret):
543556
with open(secret) as file:
544557
secret = json.load(file)
545558

559+
# Google client secrets are stored within 'web' key
560+
# We will remove the key, and replace it with the dict type value of it
561+
secret = secret['web']
562+
546563
return secret

0 commit comments

Comments
 (0)