Skip to content

Allow to pass a token to the embed script#4005

Open
gregberge wants to merge 2 commits intomainfrom
greg/rnd-9616-embed-bootstrap-script-auto-initializes-without-visitor-jwt
Open

Allow to pass a token to the embed script#4005
gregberge wants to merge 2 commits intomainfrom
greg/rnd-9616-embed-bootstrap-script-auto-initializes-without-visitor-jwt

Conversation

@gregberge
Copy link
Contributor

@gregberge gregberge commented Feb 13, 2026

Also linked to https://app.gitbook.com/o/d8f63b60-89ae-11e7-8574-5927d48c4877/s/NkEGS7hzeqa35sMXQZ4X/~/changes/947/publishing-documentation/embedding/implementation/script

Why do we use a data attribute and not a query parameter? Because query parameters travels through networks, logs, etc. So using a data parameter is better for security.

We need to use ?jwt_token to access the site behind VA anyway.

Copilot AI review requested due to automatic review settings February 13, 2026 12:47
@linear
Copy link

linear bot commented Feb 13, 2026

@changeset-bot
Copy link

changeset-bot bot commented Feb 13, 2026

⚠️ No Changeset found

Latest commit: 3e28abf

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

Copy link
Contributor

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 passing authentication tokens via URL parameters in the embed script. Users can now include a token in the script src URL (e.g., script.js?token=...), which will be automatically extracted and passed to the GitBook initialization for visitor authentication.

Changes:

  • Added getScriptSearchParams() function to extract URL parameters from the script tag's src attribute
  • Token parameter is retrieved from the script URL and passed to GitBook init via the initFrameOptions parameter
  • Both initialization branches (pre-loaded and lazy-loaded GitBook) now receive the token

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

@argos-ci
Copy link

argos-ci bot commented Feb 13, 2026

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
customers-v2 (Inspect) 👍 Changes approved 9 changed Feb 13, 2026, 2:29 PM
v2-cloudflare (Inspect) 👍 Changes approved 14 changed Feb 13, 2026, 2:36 PM
v2-vercel (Inspect) 👍 Changes approved 26 changed Feb 13, 2026, 2:33 PM

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