@@ -412,6 +412,47 @@ def delete_user_account(self, id_token):
412
412
413
413
return request_object .json ()
414
414
415
+ def sign_in_with_oauth_credential (self , token ):
416
+ """ Sign In With OAuth credential.
417
+
418
+ | For more details:
419
+ | |section-sign-in-with-oauth-credential|_
420
+
421
+ .. |section-sign-in-with-oauth-credential| replace::
422
+ Firebase Auth REST API | Sign in with OAuth credential
423
+
424
+ .. _section-sign-in-with-oauth-credential:
425
+ https://firebase.google.com/docs/reference/rest/auth#section-sign-in-with-oauth-credential
426
+
427
+
428
+ :type token: dict
429
+ :param token: The OAuth credential (an ID token or access
430
+ token).
431
+
432
+ :return: User account info and Firebase Auth Tokens.
433
+ :rtype: dict
434
+ """
435
+
436
+ request_ref = "https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyAssertion?key={0}" .format (self .api_key )
437
+
438
+ data = {
439
+ 'postBody' : 'providerId={0}&{1}={2}' .format (self .provider_id , token ['type' ], token ['value' ]),
440
+ 'autoCreate' : 'true' ,
441
+ 'requestUri' : self .client_secret ['redirect_uris' ][0 ],
442
+ 'sessionId' : self .session_id ,
443
+ 'returnSecureToken' : 'true' ,
444
+ 'returnRefreshToken' : 'true' ,
445
+ 'returnIdpCredential' : 'false' ,
446
+ }
447
+
448
+ headers = {"content-type" : "application/json; charset=UTF-8" }
449
+ request_object = self .requests .post (request_ref , headers = headers , json = data )
450
+
451
+ raise_detailed_error (request_object )
452
+ self .current_user = request_object .json ()
453
+
454
+ return request_object .json ()
455
+
415
456
def update_profile (self , id_token , display_name = None , photo_url = None , delete_attribute = None ):
416
457
""" Update a user's profile (display name / photo URL).
417
458
0 commit comments