Skip to content

Fix Nuxt session cookie name resolution and token request auth method - #51

Open
janithjay wants to merge 1 commit into
thunder-id:mainfrom
janithjay:main
Open

Fix Nuxt session cookie name resolution and token request auth method#51
janithjay wants to merge 1 commit into
thunder-id:mainfrom
janithjay:main

Conversation

@janithjay

@janithjay janithjay commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Purpose

Fixes two issues preventing sign in in the @thunderid/nuxt SDK and quickstart sample app:

  1. Session Cookie Resolution: getSessionCookieName() and getTempSessionCookieName() in packages/nuxt/src/runtime/server/utils/session.ts evaluated static property access (CookieConfig.SESSION_COOKIE_NAME and CookieConfig.TEMP_SESSION_COOKIE_NAME), which returned undefined. This caused session cookies to be saved under the literal cookie name "undefined" instead of the configured vendor prefix (e.g. __thunderid__session).
  2. Token Request Configuration: The default token endpoint auth method (client_secret_basic) caused token exchange to fail with an unauthorized_client error when the Identity Provider expected credentials in the request body. Configured tokenRequest.authMethod to client_secret_post in samples/nuxt/quickstart/nuxt.config.ts.

Approach

  • Updated getSessionCookieName() and getTempSessionCookieName() in packages/nuxt/src/runtime/server/utils/session.ts to call static methods CookieConfig.getSessionCookieName(vendor) and CookieConfig.getTempSessionCookieName(vendor).
  • Configured thunderid.tokenRequest.authMethod: 'client_secret_post' in samples/nuxt/quickstart/nuxt.config.ts.

Related Issues

Related PRs

  • N/A

Checklist

  • Followed the contribution guidelines.
  • Manual test round performed and verified.
  • Documentation provided. (Add links if there are any)
  • Tests provided. (Add links if there are any)
    • Unit Tests
    • Integration Tests
  • Breaking changes. (Fill if applicable)
    • Breaking changes section filled.
    • breaking change label added.

Security checks

  • Followed secure coding standards in WSO2 Secure Coding Guidelines
  • Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets.

Summary by CodeRabbit

  • New Features

    • Added support for vendor-specific session cookie names.
    • Added token request configuration using client secret authentication in the Nuxt quickstart.
  • Chores

    • Simplified the quickstart environment template by removing obsolete application and authentication URL settings.
    • Updated Nuxt configuration for improved consistency.

Copilot AI lite review requested due to automatic review settings August 4, 2026 12:25
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@janithjay, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 36 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 14b9dc47-fdc0-47a2-bade-2b41b0125f21

📥 Commits

Reviewing files that changed from the base of the PR and between 950ecb8 and f57cb52.

📒 Files selected for processing (2)
  • packages/nuxt/src/runtime/server/utils/session.ts
  • samples/nuxt/quickstart/nuxt.config.ts
📝 Walkthrough

Walkthrough

The PR updates Nuxt session cookie helpers for vendor-specific names. It also updates the Nuxt quickstart configuration with ThunderID token authentication and removes obsolete environment variables.

Changes

Nuxt integration updates

Layer / File(s) Summary
Vendor-aware session cookie resolution
packages/nuxt/src/runtime/server/utils/session.ts
Session cookie helpers accept an optional vendor and delegate name resolution to CookieConfig.
Quickstart authentication configuration
samples/nuxt/quickstart/nuxt.config.ts, samples/nuxt/quickstart/.env.example
The quickstart adds client_secret_post token authentication, reorders CSS configuration, and removes obsolete ThunderID environment variables.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: copilot, brionmario

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes both primary fixes: session cookie name resolution and token request authentication.
Description check ✅ Passed The description covers the purpose, approach, issue reference, checklist status, and security checks; documentation and test sections remain unchecked.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes Nuxt SDK sign-in issues by correcting server-side session cookie name derivation and updating the Nuxt quickstart to use a token endpoint client authentication method compatible with the target IdP.

Changes:

  • Update Nuxt server session cookie name helpers to use CookieConfig.get*CookieName(...) instead of non-existent static properties.
  • Configure the Nuxt quickstart to use tokenRequest.authMethod: 'client_secret_post'.
  • Simplify the quickstart .env.example entries (but note the remaining doc/config references to NUXT_PUBLIC_THUNDERID_APPLICATION_ID).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
samples/nuxt/quickstart/nuxt.config.ts Adds thunderid.tokenRequest.authMethod override and cleans up config ordering.
samples/nuxt/quickstart/.env.example Removes several previously documented env vars from the quickstart example file.
packages/nuxt/src/runtime/server/utils/session.ts Fixes cookie name generation by using CookieConfig static methods.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +144 to 146
export function getSessionCookieName(vendor?: string): string {
return CookieConfig.getSessionCookieName(vendor);
}
Comment thread samples/nuxt/quickstart/.env.example
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.

[Bug]: Token exchange fails with 500 error when completing sign-in flow in Nuxt SDK

2 participants