-
Notifications
You must be signed in to change notification settings - Fork 289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(backend): Set cookies from the refresh token flow #4884
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 19d2ada The changes in this PR will be included in the next version bump. This PR includes changesets to release 10 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
return HttpResponse.json(mockJwks); | ||
}), | ||
); | ||
describe('refreshToken', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved these tests into a separate describe block, consider looking at the diff without whitespace to see the actual changes: https://github.com/clerk/javascript/pull/4884/files?w=1
@@ -64,12 +67,17 @@ export class SessionAPI extends AbstractAPI { | |||
}); | |||
} | |||
|
|||
public async refreshSession(sessionId: string, params: RefreshTokenParams) { | |||
public async refreshSession(sessionId: string, params: RefreshTokenParams & { format: 'token ' }): Promise<Token>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public async refreshSession(sessionId: string, params: RefreshTokenParams & { format: 'token ' }): Promise<Token>; | |
public async refreshSession(sessionId: string, params: RefreshTokenParams & { format: 'token' }): Promise<Token>; |
@@ -273,14 +273,16 @@ ${error.getFullMessage()}`, | |||
|
|||
try { | |||
// Perform the actual token refresh. | |||
const tokenResponse = await options.apiClient.sessions.refreshSession(decodeResult.payload.sid, { | |||
const response = await options.apiClient.sessions.refreshSession(decodeResult.payload.sid, { | |||
format: 'cookie', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want this to be set for every call ? Could this be configured and passed down from authenticateRequest
?
Description
Supports the
format=cookies
parameter for the session refresh endpoint. When this parameter is passed, the API will return an array ofset-cookie
header values to be passed along with the response.SDKI-832
Checklist
pnpm test
runs as expected.pnpm build
runs as expected.Type of change