Skip to content

forwarding rc cookies to checkout api - #688

Closed
tiaraju wants to merge 1 commit into
masterfrom
chore/rc-cookies
Closed

forwarding rc cookies to checkout api#688
tiaraju wants to merge 1 commit into
masterfrom
chore/rc-cookies

Conversation

@tiaraju

@tiaraju tiaraju commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

What problem is this solving?

This pull request enhances the way session-related cookies are handled and propagated throughout the checkout flow. The main change is the addition of support for two new cookies, VtexRCSessionIdv7 and VtexRCMacIdv7, which are now extracted from incoming requests and included in downstream requests to ensure proper session continuity and tracking.

Session Cookie Handling Improvements:

  • Added extraction of VtexRCSessionIdv7 and VtexRCMacIdv7 from incoming cookies in the WithOwnerId GraphQL directive, and stored them in the context for downstream use (node/directives/withOwnerId.ts).
  • Updated the global context type definition to include rcSessionIdv7 and rcMacIdv7 fields, ensuring type safety and clarity (node/globals.ts).

Cookie Utility Enhancements:

  • Introduced constants and getter functions for the new cookies (VtexRCSessionIdv7 and VtexRCMacIdv7) in the cookie utility module, centralizing cookie name management and retrieval logic (node/utils/cookie.ts). [1] [2]

Checkout Client Updates:

  • Modified the Checkout client to append the new session cookies to the Cookie header in all outgoing requests, ensuring that these cookies are forwarded as needed (node/clients/checkout.ts). [1] [2]

How to test it?

[Workspace](Link goes here!)

Screenshots or example usage:

Describe alternatives you've considered, if any.

Related to / Depends on

How does this PR make you feel? 🔗

![](put .gif link here - can be found under "advanced" on giphy)

@tiaraju
tiaraju requested a review from a team as a code owner April 30, 2026 18:41
@tiaraju
tiaraju requested review from RodrigoTadeuF, leo-prange-vtex and vsseixaso and removed request for a team April 30, 2026 18:41
@vtex-io-ci-cd

vtex-io-ci-cd Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Hi! I'm VTEX IO CI/CD Bot and I'll be helping you to publish your app! 🤖

Please select which version do you want to release:

  • Patch (backwards-compatible bug fixes)

  • Minor (backwards-compatible functionality)

  • Major (incompatible API changes)

And then you just need to merge your PR when you are ready! There is no need to create a release commit/tag.

  • No thanks, I would rather do it manually 😞

@vtex-io-docs-bot

Copy link
Copy Markdown

Beep boop 🤖

I noticed you didn't make any changes at the docs/ folder

  • There's nothing new to document 🤔
  • I'll do it later 😞

In order to keep track, I'll create an issue if you decide now is not a good time

  • I just updated 🎉🎉

@github-actions

Copy link
Copy Markdown
Fails
🚫

We follow keepachangelog standards.

Please, change the file CHANGELOG.md adding a small summary of your changes under the [Unreleased] section. Example:

 ## [Unreleased]

+ ### Fixed
+ - Issue with image sizing in the SKU Selector.

Possible types of changes:

  • Added for new features.
  • Changed for changes in existing functionality.
  • Deprecated for soon-to-be removed features.
  • Removed for now removed features.
  • Fixed for any bug fixes.
  • Security in case of vulnerabilities.

Generated by 🚫 dangerJS against a3ae67c

@tiaraju
tiaraju requested a review from jeffersontuc April 30, 2026 18:42
vsseixaso pushed a commit that referenced this pull request May 11, 2026
#### What problem is this solving?

Related to #688. I've created this other one due to the recent major
changes in the repo.

This pull request adds support for forwarding two additional cookies,
`VtexRCSessionIdv7` and `VtexRCMacIdv7`, to the Checkout API. These
cookies are now extracted from incoming requests and included in the
headers sent to the Checkout API, ensuring session continuity and
improved authentication handling.

**Cookie forwarding improvements:**

* Updated the `Checkout` client to include `VtexRCSessionIdv7` and
`VtexRCMacIdv7` cookies in the `Cookie` header when making requests to
the Checkout API.
[[1]](diffhunk://#diff-0a017c0453694f2c53c4774f6261676f4692532b233e1b747bbb77b6542e259cL33-R33)
[[2]](diffhunk://#diff-0a017c0453694f2c53c4774f6261676f4692532b233e1b747bbb77b6542e259cR46-R50)
* Modified the `WithOwnerId` GraphQL directive to extract
`VtexRCSessionIdv7` and `VtexRCMacIdv7` from incoming cookies and set
them on the context object for downstream use.

**Utility and type updates:**

* Added utility functions `getRcSessionIdFromCookie` and
`getRcMacIdFromCookie` to extract the new cookies, and defined their
constant names in `cookie.ts`.
* Extended the global `CustomIOContext` type to include the new cookie
values, ensuring type safety and availability throughout the codebase.

**Documentation:**

* Updated the `CHANGELOG.md` to document the addition of forwarding the
new cookies to the Checkout API.
<!--- What is the motivation and context for this change? -->

#### How to test it?

<!--- Don't forget to add a link to a Workspace where this branch is
linked -->

[Workspace](Link goes here!)

#### Screenshots or example usage:

<!--- Add some images or gifs to showcase changes in behaviour or
layout. Example: before and after images -->

#### Describe alternatives you've considered, if any.

<!--- Optional -->

#### Related to / Depends on

<!--- Optional -->

#### How does this PR make you feel? [:link:](http://giphy.com/)

<!-- Go to http://giphy.com/ and pick a gif that represents how this PR
makes you feel -->

![](put .gif link here - can be found under "advanced" on giphy)
@vsseixaso vsseixaso closed this May 13, 2026
@vsseixaso

Copy link
Copy Markdown
Contributor

PR closed in favor of #695.

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.

2 participants