Skip to content

Fix: Auth route re-extracts Bearer token redundantly#134

Open
Xenon010101 wants to merge 1 commit into
madanrajsagar:mainfrom
Xenon010101:fix/bug-63-redundant-token
Open

Fix: Auth route re-extracts Bearer token redundantly#134
Xenon010101 wants to merge 1 commit into
madanrajsagar:mainfrom
Xenon010101:fix/bug-63-redundant-token

Conversation

@Xenon010101

Copy link
Copy Markdown

Closes #63

Root cause: Three handlers in backend/routes/auth.js (profile lookup at line 575, profile update at line 679, account delete at line 746) re-extracted the Bearer token from req.headers.authorization even though verifyToken already extracted and verified it.

Fix: Stored the raw idToken in req.user.idToken within the verifyToken middleware (in both Firebase Admin SDK and REST API paths). Updated the three handlers to use req.user.idToken instead of re-parsing headers.

Closes madanrajsagar#63

Stored idToken in req.user within verifyToken middleware (both Firebase
Admin SDK and REST API paths) and replaced 3 redundant re-extractions
in profile lookup, profile update, and account delete handlers.

Signed-off-by: Xenon010101 <xenon010101@users.noreply.github.com>
@Xenon010101

Copy link
Copy Markdown
Author

👋 Hi! Following up on this PR. Let me know if anything needs to be changed or if there's more context needed. Thanks!

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

Successfully merging this pull request may close these issues.

auth route re-extracts Bearer token redundantly

1 participant