Skip to content

refresh token#364

Merged
prooflesben merged 2 commits intomainfrom
343-dev---set-up-authrefresh-route-and-frontend-refresh-token-logic
Mar 26, 2026
Merged

refresh token#364
prooflesben merged 2 commits intomainfrom
343-dev---set-up-authrefresh-route-and-frontend-refresh-token-logic

Conversation

@adityapat24
Copy link
Copy Markdown
Contributor

ℹ️ Issue

Closes #343

📝 Description

Added refresh token functionality

Briefly list the changes made to the code:

  • Updated backend POST /auth/refresh to return the refreshed idToken and a refreshToken (and to set the refresh_token cookie, using Cognito’s rotated token when available).

  • Added frontend auto-refresh behavior in bcan/frontend/src/api.ts: on a 401 (except /auth/refresh), it calls /auth/refresh once and retries the original request.

  • Adjusted backend JWT guards to throw UnauthorizedException / ForbiddenException instead of silently returning false, so the frontend can reliably detect expired/invalid access tokens.

✔️ Verification

Backend tests plus running frontend

@adityapat24 adityapat24 requested a review from prooflesben March 19, 2026 19:05
@adityapat24 adityapat24 linked an issue Mar 19, 2026 that may be closed by this pull request
Copy link
Copy Markdown
Collaborator

@prooflesben prooflesben left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take out returning the tokens in the request. You should only be setting the cookies and return just a message saying things went well

@prooflesben prooflesben merged commit e00da50 into main Mar 26, 2026
1 check passed
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.

DEV - Set up /auth/refresh route and frontend refresh token logic

2 participants