mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-26 01:06:00 +03:00
[PR #5948] fix(auth): allow refresh token extraction from Authorization header f… #5429
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#5429
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/hoppscotch/hoppscotch/pull/5948
Author: @sahilkhan09k
Created: 3/5/2026
Status: 🔄 Open
Base:
main← Head:fix-refresh-token-header-support📝 Commits (4)
f610e33fix(auth): allow refresh token extraction from Authorization header for desktop client407cfac(auth) fix : Updated the split to slice47f2202(auth) fix : Changed the non-ascii to ascii character3bd64b5(auth) fix : Changed the function to be more optimal📊 Changes
1 file changed (+33 additions, -9 deletions)
View changed files
📝
packages/hoppscotch-backend/src/auth/strategies/rt-jwt.strategy.ts(+33 -9)📄 Description
Closes #5635
This PR fixes an issue where the desktop client cannot refresh authentication tokens after the access token expires. The backend currently only extracts the refresh token from cookies, while the desktop client sends it through the Authorization Bearer header. As a result, the refresh request fails with COOKIES_NOT_FOUND, forcing users to repeatedly log in.
What's changed
Updated the refresh token extraction logic in RTJwtStrategy.
Added support for extracting the refresh token from the Authorization: Bearer header.
Kept the existing cookie-based extraction to ensure the web client continues to work as before.
Added a fallback mechanism so the backend now accepts refresh tokens from:
refresh_token cookie (web client)
Authorization header (desktop client)
Notes to reviewers
The desktop client already sends the refresh token using the Authorization header during refresh requests. However, the backend strategy only checked for the token in cookies, causing refresh requests to fail with COOKIES_NOT_FOUND.
This change preserves the current cookie-based flow used by the web application while adding compatibility with the desktop client by supporting header-based token extraction.
Summary by cubic
Allow refresh tokens to be read from the Authorization: Bearer header, fixing desktop token refresh failures. Keeps the cookie flow for web and resolves #5635.
Written for commit
3bd64b5066. Summary will update on new commits.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.