Calls to firebase_auth.get_user() can add 100-200ms to request time
See original GitHub issueHi,
Just reviewing my web API performance and found high latency whenever firebase_auth.get_user() is called, since it sends a blocking HTTP request to the Firebase Auth API.
I’ve read a few different Python Firebase Auth tutorials and they all just use the decoded JWT to supply user data, they do not make a call out to the Firebase web API. This makes sense since a synchronous HTTP call is bad for performance.
If FIREBASE_CHECK_JWT_REVOKED
is enabled, the get_user() call is made twice per request cycle. One of these calls is surely redundant.
Apart from revocation is there a reason to fetch the user rather than using the properties that are already embedded in the JWT?
Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Firebase Authentication Limits
The following limits are daily usage limits for users of Firebase Authentication with Identity Platform on the no-cost Spark plan.
Read more >Build a Role-based API with Firebase Authentication - Toptal
In a nutshell, Firebase Authentication is an extensible token-based auth ... Now, we can call the API to get the logged-in user by...
Read more >Using Firebase Authentication - FlutterFire
If the user signs in anonymously multiple times, they will be signed-in with the ... To get started, call the signInAnonymously() method on...
Read more >Getting started with Firebase Authentication on the web
In this episode of Firebase Fundamentals, Firebase Developer Advocate Peter Friese will show you how to get up and running quickly with ...
Read more >Firebase Auth Tutorial #15- Firestore Users Collection
Hey gang, in this Firebase auth tutorial I'll show you how to create a Users collection in our Firestore database and store additionaluser ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey guys this is still on my radar, just need to find time to get my head into it. Thanks for the feedback so far!
If there is some sort of consensus re: best way forward and I haven’t gotten to it yet, feel free to make a pull req.
Have opened a ticket in Trello to track this, feel free to add code snippets/screenshots/more info
https://trello.com/c/RlMcBCmi
I’ve looked a bit into this question, here are the result of my investigation, so that if someone is interested in solving this, s.he can have more info on this. At the moment, when a request is received by Django,
FirebaseAuthentication
:uid
out of the JWT tokenThe step in bold includes a request to Firebase.
What it truly should be doing is:
uid
and theemail
out of the JWT tokenThat way, a trip to Firebase is only needed during local user creation. In case the local user creation doesn’t require data from the firebase user, a request to Firebase is not even needed.
I’ll try to create a PR if I get the time to do this.