Skip to content

refresh token#364

Open
adityapat24 wants to merge 1 commit intomainfrom
343-dev---set-up-authrefresh-route-and-frontend-refresh-token-logic
Open

refresh token#364
adityapat24 wants to merge 1 commit intomainfrom
343-dev---set-up-authrefresh-route-and-frontend-refresh-token-logic

Conversation

@adityapat24
Copy link
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

Copy link
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

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