Skip to content

Handle OIDC error responses in visitor-auth callback#1109

Draft
SamyPesse wants to merge 2 commits intomainfrom
codex/linear-mention-rnd-9548-oidc-integration-loops-if-the-acc
Draft

Handle OIDC error responses in visitor-auth callback#1109
SamyPesse wants to merge 2 commits intomainfrom
codex/linear-mention-rnd-9548-oidc-integration-loops-if-the-acc

Conversation

@SamyPesse
Copy link
Member

Motivation

  • Prevent an infinite loop when the OIDC provider redirects back with error/error_description instead of an authorization code by forwarding the error to the published site rather than attempting a token exchange.

Description

  • Added early handling in router.get('/visitor-auth/response') to detect request.query.error and redirect to the published content URL with error and optional error_description query parameters.
  • Preserve original state-derived location when building the redirect target so the user lands in the same location on the published site.
  • Return a clear 500 Response when the site's published URL is missing.

Testing

  • No automated tests were run for this change.

Codex Task

@linear
Copy link

linear bot commented Feb 2, 2026

@changeset-bot
Copy link

changeset-bot bot commented Feb 2, 2026

⚠️ No Changeset found

Latest commit: 137ad2d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 2, 2026

Open in StackBlitz

bun add https://pkg.pr.new/GitbookIO/integrations/@gitbook/api@1109

commit: 137ad2d

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant