Skip to content

Conversation

pvaneveld
Copy link
Collaborator

No description provided.

Copy link

changeset-bot bot commented Sep 17, 2025

🦋 Changeset detected

Latest commit: 73b29de

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

This PR includes changesets to release 5 packages
Name Type
@labdigital/federated-token-express-adapter Minor
@labdigital/federated-token-fastify-adapter Minor
@labdigital/federated-token Minor
@labdigital/federated-token-apollo Minor
@labdigital/federated-token-yoga Minor

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

@pvaneveld pvaneveld changed the title Refresh token and cookie path support feat: refresh token path and cookie path support Sep 17, 2025
@pvaneveld pvaneveld marked this pull request as ready for review September 17, 2025 15:05
Copy link

@Copilot Copilot AI left a 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.

Comment on lines 10 to 13
refreshTokenPath: string | ((request: Request) => string | undefined);
publicDomainFn?: (request: FastifyRequest) => string | undefined;
privateDomainFn?: (request: FastifyRequest) => string | undefined;
cookiePathFn?: (request: Request) => string | undefined;
Copy link
Preview

Copilot AI Sep 17, 2025

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.

Suggested change
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.

Comment on lines 10 to 13
refreshTokenPath: string | ((request: Request) => string | undefined);
publicDomainFn?: (request: FastifyRequest) => string | undefined;
privateDomainFn?: (request: FastifyRequest) => string | undefined;
cookiePathFn?: (request: Request) => string | undefined;
Copy link
Preview

Copilot AI Sep 17, 2025

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.

Suggested change
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;
Copy link
Preview

Copilot AI Sep 17, 2025

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.

@pvaneveld pvaneveld merged commit 32e8514 into main Sep 18, 2025
5 checks passed
@pvaneveld pvaneveld deleted the refreshTokenAndCookiePathSupport branch September 18, 2025 09:12
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.

1 participant