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

FB ve Google Login #56

Open
mthnzbk opened this issue Dec 21, 2022 · 4 comments
Open

FB ve Google Login #56

mthnzbk opened this issue Dec 21, 2022 · 4 comments

Comments

@mthnzbk
Copy link

mthnzbk commented Dec 21, 2022

Will the methods for logging in with facebook-google be added?

@AsifArmanRahman
Copy link

@mthnzbk in case you need those methods for a project, check firebase-rest-api where I've already implemented them.

@mthnzbk
Copy link
Author

mthnzbk commented Dec 25, 2022

`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
print(auth.authenticate_login_with_facebook())
File "C:\Users\venv\lib\site-packages\firebase\auth_init_.py", line 78, in authenticate_login_with_facebook
return self.create_authentication_uri('facebook.com')
File "C:\Users\venv\lib\site-packages\firebase\auth_init_.py", line 127, in create_authentication_uri
raise_detailed_error(request_object)
File "C:\User\venv\lib\site-packages\firebase_exception.py", line 17, in raise_detailed_error
raise HTTPError(e, request_object.text)
requests.exceptions.HTTPError: [Errno 400 Client Error: Bad Request for url: https://www.googleapis.com/identitytoolkit/v3/relyingparty/createAuthUri?key=AIzaSyDFP8PMnJzIl-4q8fsnkz1uvEPE3nHivcA] {
"error": {
"code": 400,
"message": "INVALID_CONTINUE_URI",
"errors": [
{
"message": "INVALID_CONTINUE_URI",
"domain": "global",
"reason": "invalid"
}
]
}
}`

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" }

@AsifArmanRahman
Copy link

@mthnzbk please report the issue in firebase-rest-api repository.

@absolutelyspoton
Copy link

absolutelyspoton commented Feb 4, 2023

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.

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

No branches or pull requests

3 participants