Skip to content

fix(navbar): recognize authenticated users with active sessions#1113

Draft
Copilot wants to merge 1 commit into
masterfrom
copilot/fix-issue-1112
Draft

fix(navbar): recognize authenticated users with active sessions#1113
Copilot wants to merge 1 commit into
masterfrom
copilot/fix-issue-1112

Conversation

Copilot AI commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Authenticated users on cloud.layer5.io were not recognized on docs.layer5.io because checkUserAuth bailed out before making the API call when the provider_token cookie wasn't present on the docs subdomain. Safari and other browsers with strict cookie isolation are particularly affected.

Changes:

  • Removed early throw when provider_token cookie is absent — the function now always attempts the API call
  • Added credentials: 'include' to the fetch so the browser sends cloud.layer5.io session cookies cross-origin
  • ****** still sent when the local cookie exists (backward compatible)
const fetchOptions = {
  method: 'GET',
  credentials: 'include',
};

if (token) {
  fetchOptions.headers = {
    'Authorization': `******
  };
}

const re = await fetch(`${cloudAppUrl}/api/identity/users/profile`, fetchOptions);

Note: This requires the cloud.layer5.io API to respond with appropriate Access-Control-Allow-Credentials: true and Access-Control-Allow-Origin headers for docs.layer5.io. If CORS isn't already configured for credentialed requests, a corresponding server-side change will be needed.

…de in fetch

Previously, the checkUserAuth function would bail out immediately when the
provider_token cookie was not available on the docs subdomain. This meant
users who were authenticated on cloud.layer5.io were not recognized on
docs.layer5.io, particularly in browsers like Safari with strict cookie policies.

The fix adds credentials: 'include' to the fetch request so the browser sends
cloud.layer5.io's session cookies with the API call, and removes the early
bailout when the local cookie is missing.

Fixes #1112
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Preview deployment: https://docs.layer5.io/pr-preview/pr-1113/

Note: Preview may take a moment (GitHub Pages deployment in progress). Please wait and refresh. Track deployment here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants