最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - Occasional "Invalid email or password" with Firebase auth in pyrebase4 - Stack Overflow

programmeradmin2浏览0评论

I am using Firebase's Firestore and have built a backend API server using FastAPI. I am also using Firebase's login feature with the Pyrebase4 library (referenced from: .md). After deployment, around 10 company employees accessed and used it simultaneously, but at some point, the login stopped working. Currently, I suspect that the sign_in_with_email_and_password function in Pyrebase4, which handles login, is causing the issue when sending login requests. However, I am having trouble finding information related to request limits or traffic, so I am reaching out for help.

If you need any adjustments or additional information, feel free to let me know!

The client's request is successfully received by the backend, but it returns a 401 Unauthorized error. Since everyone was using it without issues until suddenly it stopped working, I'm not sure what the reason is. The function provided by Pyrebase4 is as follows:

def sign_in_with_email_and_password(self, email, password):     
    request_ref = "={0}".format(self.api_key)     
    headers = {"content-type": "application/json; charset=UTF-8"}     
    data = json.dumps({"email": email, "password": password, "returnSecureToken": True})
    request_object = requests.post(request_ref, headers=headers, data=data) 
    raise_detailed_error(request_object)    
    self.current_user = request_object.json()    
    return request_object.json()

I'm calling it like this:

user = fire_auth.sign_in_with_email_and_password(form_data.username, form_data.password)

When I call it through Swagger, it returns:

Invalid email or password.

发布评论

评论列表(0)

  1. 暂无评论