Skip to content

Conversation

@brkalow
Copy link
Member

@brkalow brkalow commented Jan 13, 2025

Description

Supports the format=cookies parameter for the session refresh endpoint. When this parameter is passed, the API will return an array of set-cookie header values to be passed along with the response.

SDKI-832

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@changeset-bot
Copy link

changeset-bot bot commented Jan 13, 2025

🦋 Changeset detected

Latest commit: 3998837

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
Name Type
@clerk/backend Minor
@clerk/astro Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/nextjs Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/remix Patch
@clerk/tanstack-start Patch
@clerk/testing Patch

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

@vercel
Copy link

vercel bot commented Jan 13, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
clerk-js-sandbox ⬜️ Skipped (Inspect) Jan 15, 2025 2:58am

return HttpResponse.json(mockJwks);
}),
);
describe('refreshToken', async () => {
Copy link
Member Author

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

@brkalow brkalow marked this pull request as ready for review January 14, 2025 03:58
@brkalow brkalow requested a review from a team January 14, 2025 03:58
// 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',
Copy link
Member

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 ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't see a good reason to make it configurable, not setting the cookie allows requests to fire with the expired session token before clerk-js hydrates.

Co-authored-by: panteliselef <panteliselef@outlook.com>
@brkalow brkalow requested a review from a team January 15, 2025 03:01
@brkalow brkalow merged commit e9e8834 into main Jan 15, 2025
29 checks passed
@brkalow brkalow deleted the brk.feat/refresh-token-set-cookies branch January 15, 2025 22:33
wobsoriano pushed a commit that referenced this pull request Feb 8, 2025
Co-authored-by: panteliselef <panteliselef@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants