Conversation
|
There was a problem hiding this comment.
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
initFrameOptionsparameter - 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.
...s/gitbook/src/app/sites/static/[mode]/[siteURL]/[siteData]/~gitbook/embed/script.js/route.ts
Show resolved
Hide resolved
...s/gitbook/src/app/sites/static/[mode]/[siteURL]/[siteData]/~gitbook/embed/script.js/route.ts
Outdated
Show resolved
Hide resolved
...s/gitbook/src/app/sites/static/[mode]/[siteURL]/[siteData]/~gitbook/embed/script.js/route.ts
Outdated
Show resolved
Hide resolved
...s/gitbook/src/app/sites/static/[mode]/[siteURL]/[siteData]/~gitbook/embed/script.js/route.ts
Show resolved
Hide resolved
...s/gitbook/src/app/sites/static/[mode]/[siteURL]/[siteData]/~gitbook/embed/script.js/route.ts
Outdated
Show resolved
Hide resolved
...s/gitbook/src/app/sites/static/[mode]/[siteURL]/[siteData]/~gitbook/embed/script.js/route.ts
Outdated
Show resolved
Hide resolved
...s/gitbook/src/app/sites/static/[mode]/[siteURL]/[siteData]/~gitbook/embed/script.js/route.ts
Show resolved
Hide resolved
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
082c837 to
6e11a7e
Compare
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_tokento access the site behind VA anyway.