GithubHelp home page GithubHelp logo

FB ve Google Login about pyrebase4 HOT 4 OPEN

nhorvath avatar nhorvath commented on August 15, 2024
FB ve Google Login

from pyrebase4.

Comments (4)

AsifArmanRahman avatar AsifArmanRahman commented on August 15, 2024 1

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

from pyrebase4.

AsifArmanRahman avatar AsifArmanRahman commented on August 15, 2024

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

from pyrebase4.

mthnzbk avatar mthnzbk commented on August 15, 2024

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

from pyrebase4.

absolutelyspoton avatar absolutelyspoton commented on August 15, 2024

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.

from pyrebase4.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.