-
Notifications
You must be signed in to change notification settings - Fork 0
feat: refresh token path and cookie path support #194
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
Conversation
🦋 Changeset detectedLatest commit: 73b29de The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 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 |
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.
Pull Request Overview
This PR adds support for configurable cookie paths for both authentication and refresh tokens. The changes allow developers to specify custom paths for cookies through function callbacks that receive the request object, providing more flexibility in cookie path configuration.
- Adds
cookiePathFn
option to configure paths for auth tokens (guest/user tokens) - Makes
refreshTokenPath
configurable via function in addition to static strings - Updates all adapters (Express and Fastify) to support the new path configuration options
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
packages/core/src/tokensource/cookies-base.ts | Core implementation of configurable cookie paths with new helper method |
packages/express-adapter/src/cookies.ts | Express adapter type updates for new path options |
packages/fastify-adapter/src/cookies.ts | Fastify adapter type updates for new path options |
packages/core/src/tokensource/cookies-base.test.ts | Test updates and new test cases for path configuration |
.changeset/tidy-tips-study.md | Changeset documenting the new feature |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
refreshTokenPath: string | ((request: Request) => string | undefined); | ||
publicDomainFn?: (request: FastifyRequest) => string | undefined; | ||
privateDomainFn?: (request: FastifyRequest) => string | undefined; | ||
cookiePathFn?: (request: Request) => string | undefined; |
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.
The function signatures use generic Request
type instead of the more specific FastifyRequest
type. This creates inconsistency with other properties like publicDomainFn
and privateDomainFn
which use FastifyRequest
. Consider using FastifyRequest
for consistency.
refreshTokenPath: string | ((request: Request) => string | undefined); | |
publicDomainFn?: (request: FastifyRequest) => string | undefined; | |
privateDomainFn?: (request: FastifyRequest) => string | undefined; | |
cookiePathFn?: (request: Request) => string | undefined; | |
refreshTokenPath: string | ((request: FastifyRequest) => string | undefined); | |
publicDomainFn?: (request: FastifyRequest) => string | undefined; | |
privateDomainFn?: (request: FastifyRequest) => string | undefined; | |
cookiePathFn?: (request: FastifyRequest) => string | undefined; |
Copilot uses AI. Check for mistakes.
refreshTokenPath: string | ((request: Request) => string | undefined); | ||
publicDomainFn?: (request: FastifyRequest) => string | undefined; | ||
privateDomainFn?: (request: FastifyRequest) => string | undefined; | ||
cookiePathFn?: (request: Request) => string | undefined; |
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.
The function signatures use generic Request
type instead of the more specific FastifyRequest
type. This creates inconsistency with other properties like publicDomainFn
and privateDomainFn
which use FastifyRequest
. Consider using FastifyRequest
for consistency.
refreshTokenPath: string | ((request: Request) => string | undefined); | |
publicDomainFn?: (request: FastifyRequest) => string | undefined; | |
privateDomainFn?: (request: FastifyRequest) => string | undefined; | |
cookiePathFn?: (request: Request) => string | undefined; | |
refreshTokenPath: string | ((request: FastifyRequest) => string | undefined); | |
publicDomainFn?: (request: FastifyRequest) => string | undefined; | |
privateDomainFn?: (request: FastifyRequest) => string | undefined; | |
cookiePathFn?: (request: FastifyRequest) => string | undefined; |
Copilot uses AI. Check for mistakes.
refreshTokenPath: string | ((request: Request) => string | undefined); | ||
publicDomainFn?: (request: Request) => string | undefined; | ||
privateDomainFn?: (request: Request) => string | undefined; | ||
cookiePathFn?: (request: Request) => string | undefined; |
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.
The function signatures correctly use the Express Request
type, which is consistent with other properties in this interface. This is the expected pattern for the Express adapter.
Copilot uses AI. Check for mistakes.
No description provided.