Authentification
Utilisez Docs Embed avec des sites nécessitant une authentification en transmettant des tokens visiteurs ou en utilisant l'accès authentifié
Approche 1 : Transmettre le jeton directement (Recommandé)
<script src="https://docs.company.com/~gitbook/embed/script.js"></script>
<script>
window.GitBook(
"init",
{ siteURL: "https://docs.company.com" },
{ visitor: { token: "your-jwt-token" } }
);
window.GitBook("show");
</script>import { createGitBook } from "@gitbook/embed";
const gitbook = createGitBook({
siteURL: "https://docs.company.com",
});
const iframe = document.createElement("iframe");
iframe.src = gitbook.getFrameURL({
visitor: {
token: "your-jwt-token",
unsignedClaims: { userId: "123", plan: "premium" },
},
});Approche 2 : Détection via cookie
Pièges courants
Débogage
Prochaines étapes
Mis à jour
Ce contenu vous a-t-il été utile ?