Open mthnzbk opened 1 year ago
@mthnzbk in case you need those methods for a project, check firebase-rest-api where I've already implemented them.
`Traceback (most recent call last): File "C:\Users\venv\lib\site-packages\firebase_exception.py", line 13, in raise_detailed_error request_object.raise_for_status() File "C:\Users\venv\lib\site-packages\requests\models.py", line 1021, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://www.googleapis.com/identitytoolkit/v3/relyingparty/createAuthUri?key=AIzaSyDFP8PMnJzIl-4q8fsnkz1uvEPE3nHivcA
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\main.py", line 34, in
I think I entered the information correctly. this is the error I get.
auth = firebase.auth(client_secret="client_secret.json") auth.authenticate_login_with_facebook()
client_secret.json:
{ "client_id": "1234", "client_secret": "1a2s", "redirect_uris": "https://xxx.firebaseapp.com/__/auth/handler" }
@mthnzbk please report the issue in firebase-rest-api repository.
I implemented the method sign_in_with_idp_token for the Auth class, which works nicely ; be good to see this added into the main branch.
def sign_in_with_idp_token(self, token, redirect_uri, provider):
request_ref = "https://identitytoolkit.googleapis.com/v1/accounts:signInWithIdp?key={0}".format(self.api_key)
headers = {"content-type": "application/json; charset=UTF-8"}
postbody = "id_token=" + token + "&providerId=" + provider
data = json.dumps({"postBody":postbody,"requestUri":redirect_uri,"returnIdpCredential":True,"returnSecureToken":True})
request_object = requests.post(request_ref, headers=headers, data=data)
raise_detailed_error(request_object)
return request_object.json()
Params ( token = id_token (oauth token given back from the provider), redirect_uri e.g. "https://localhost", and provider is the identify platform provider e.g. "google.com" for google signin. Tested for Google, but should work with other providers ok.
Will the methods for logging in with facebook-google be added?