> For the complete documentation index, see [llms.txt](https://gitbook.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.com/docs/documentation/ja-gitbook-documentation/publish/site-audience/authenticated-access/setting-up-oidc.md). Agents can also search and read this documentation through its [MCP server](https://gitbook.com/docs/~gitbook/mcp).

# OIDC の設定

ドキュメント閲覧者向けに OIDC のログイン画面を設定します

{% hint style="warning" %}
このガイドでは、ドキュメント用の保護されたサインイン画面を設定する手順を説明します。このガイドを始める前に、まず次の手順を完了してください。 [認証済みアクセスを有効にする](https://gitbook.com/docs/documentation/ja-gitbook-documentation/publish/site-audience/authenticated-access/enabling-authenticated-access.md).
{% endhint %}

OIDC を使用した認証アクセスで GitBook サイトをセットアップする手順は、次のようになります:

{% stepper %}
{% step %}
**ID プロバイダーで新しいアプリケーションを作成する**

ID プロバイダーのダッシュボードからアプリケーションを作成します。
{% endstep %}

{% step %}
**OIDC 統合をインストールして設定する**

OIDC 統合をインストールし、必要な設定を追加します。
{% endstep %}
{% endstepper %}

OIDC は OpenID Connect の略で、OAuth の上に構築された ID 層です。多くの ID プロバイダーは OIDC に準拠しており、GitBook の認証アクセス用 OIDC 統合を使うと、コンテンツを認証アクセスの背後に公開でき、コンテンツへのアクセスは ID プロバイダーによって制御されます。

{% hint style="info" %}
このガイドはすべての ID プロバイダー向けの汎用ガイドであるため、詳細の一部は ID プロバイダーによって異なる場合があります。説明のため、このガイドでは Google を ID プロバイダーとして使用しています。
{% endhint %}

### ID プロバイダーで新しいアプリケーションを作成する

統合を動作させるには、ID プロバイダー側で設定しておくべき項目がいくつかあります。

ID プロバイダー内に新しいアプリを作成する必要があります。種類は「Web Application」にしてください。Google では、「API とサービス」→「認証情報」→「OAuth 2.0 Client IDs」から作成します。\\

<figure><img src="https://4217681718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2Fgit-blob-9c6eb6906e7538334ec7c87feb21d736ced5b599%2F25_04_10_setting_up_oidc_1.png?alt=media" alt="A screenshot showing creation of an OAuth client in an identity provider"><figcaption></figcaption></figure>

［認証情報を作成］をクリックし、［OAuth クライアント ID］を選択し、種類として［Web Application］を選び、適切な名前を付け、［承認済みのリダイレクト URI］に GitBook から取得した Callback URL を入力します。

［作成］をクリックします。Client ID と Client Secret を控えておいてください。GitBook で統合の設定を完了する際に必要になります。

### OIDC 統合をインストールして設定する

GitBook アプリ内の Integrations に移動し、カテゴリとして［authenticated access］を選択して、OIDC 統合をインストールします。選択した docs サイトに OIDC 統合をインストールしてください。

<figure><img src="https://4217681718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2Fgit-blob-eacab294e24488e224d7378a7788c8958026486e%2F25_04_10_setting_up_oidc_2.png?alt=media" alt="A GitBook screenshot showing the OIDC integration installation"><figcaption></figcaption></figure>

サイトにインストールしたら、設定画面に移動し、［Save］ボタンのすぐ上にある Callback URL を控えておきます。ID プロバイダーの設定に必要になる場合があります。

統合をインストールしたセクションの OIDC 統合の設定画面を開きます。

次の画像のようになります：

<figure><img src="https://4217681718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2Fgit-blob-6a1903abcc5ef080306f5fbc9579526a8b8e607c%2F25_04_10_setting_up_oidc_3.png?alt=media" alt="A GitBook screenshot showing the OIDC configuration screen"><figcaption></figcaption></figure>

Client ID と Client Secret には、ID プロバイダーから取得した値を貼り付けます。

次に、ID プロバイダーの Authorization Endpoint と Access Token Endpoint を確認します。Google の場合は、次のとおりです。 `https://accounts.google.com/o/oauth2/v2/auth` と `https://oauth2.googleapis.com/token` です。

{% hint style="info" %}
Google を使用していない場合、これらのエンドポイントは異なります。該当するエンドポイントを見つけるには、ID プロバイダーのドキュメントを確認してください。
{% endhint %}

OAuth Scope の値は、使用する ID プロバイダーによって異なります。Google の場合は、次のように入力します。 `openid`.

{% hint style="info" %}
ID プロバイダーのドキュメントにある許可済みスコープの一覧を確認し、最も権限の弱いスコープの値を入力してください。私たちは Access Token を、ユーザーが認証済みであることを確認するためだけに使用し、それ以上の情報を取得するためには使用しません。そのため、最も権限の弱いスコープを入力するのが最善のセキュリティ上の推奨事項です。
{% endhint %}

Save をクリックします。

次に、GitBook でインテグレーションのモーダルを閉じ、［サイトを管理］ボタンをクリックします。［ **オーディエンス**］に移動し、 **認証済みアクセス**を選択して、バックエンドとして OIDC を選びます。次に、［ **オーディエンスを更新**］をクリックします。サイトの画面に移動し、［ **公開**］をクリックします。\
\
サイトは、ID プロバイダーによって制御される認証済みアクセスの背後で公開されます。動作を確認するには、［訪問］をクリックします。OIDC でのサインインを求められます。これにより、OIDC を使用した認証済みアクセスの背後でサイトが公開されていることを確認できます。

### PKCE を有効にする

ID プロバイダーで PKCE が必須、または推奨されている場合は、OIDC インテグレーションの設定画面で［ **PKCE を使用** ］をオンにします。このオプションを有効にすると、インテグレーションが認証プロバイダーとの間で開始する認可コードフローで、Proof Key for Code Exchange（PKCE）が使用されます。

### ログアウトを設定する

OIDC連携では、公開サイトのセッションとIDプロバイダーのセッションを終了できます。

#### エンドセッションエンドポイントを設定する

訪問者を上流のIDプロバイダーからサインアウトさせるには、そのログアウトエンドポイントを次の項目に入力します。 **エンドセッションエンドポイント**.

訪問者が公開サイトからログアウトすると、GitBookは公開サイトのセッションを終了します。また、IDプロバイダーのセッションを終了するため、設定済みのエンドポイントに訪問者を移動させます。

#### ログアウト確認プロンプトをスキップする

上流のIDプロバイダーのログアウト確認ページをスキップするには、次の項目を有効にします。 **ログアウト確認プロンプトをスキップする**.

訪問者が公開サイトからログアウトすると、GitBookは確認ページを表示せずにサインアウトさせます。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://gitbook.com/docs/documentation/ja-gitbook-documentation/publish/site-audience/authenticated-access/setting-up-oidc.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
