> 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).

# OIDC の設定

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

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

OIDC を使用して認証済みアクセスで GitBook サイトを設定する手順は、以下のとおりです。

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

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

{% step %}
**OIDC インテグレーションをインストールして設定する**

Auth0 インテグレーションをインストールし、必要な設定を追加します。
{% endstep %}
{% endstepper %}

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

{% hint style="info" %}
このガイドはすべてのアイデンティティプロバイダー向けの一般的なガイドであるため、いくつかの詳細はお使いのアイデンティティプロバイダーによって異なる場合があります。説明のため、このガイドではアイデンティティプロバイダーとして Google を使用します。
{% endhint %}

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

インテグレーションを動作させるには、アイデンティティプロバイダー側で設定しておく必要がある項目がいくつかあります。

アイデンティティプロバイダー内で新しいアプリを作成する必要があります。その種類は「Web Application」である必要があります。Google では、「API とサービス」、「認証情報」、その後「OAuth 2.0 クライアント ID」の下でこれを作成します。\\

<figure><img src="https://4217681718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2F8ra7t88ktqM7yX7w1l4m%2FScreen%20Shot%202024-05-15%20at%2011.19.59%20AM.png?alt=media&amp;token=bc1fbb59-5a36-47f8-985f-da9c743e3adb" alt="A screenshot showing creation of an OAuth client in an identity provider"><figcaption></figcaption></figure>

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

［作成］をクリックします。クライアント ID とクライアントシークレットを控えておきます。GitBook でインテグレーションの設定を完了する際に必要になります。

### OIDC インテグレーションをインストールして設定する

GitBook アプリ内のインテグレーションに移動し、カテゴリとして認証済みアクセスを選択して、OIDC インテグレーションをインストールします。選択した docs サイトに OIDC インテグレーションをインストールします。

<figure><img src="https://4217681718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2FCZy21M4LIPwMVSxI3ec1%2FScreen%20Shot%202024-12-13%20at%203.37.39%20PM.png?alt=media&amp;token=4e31d496-04eb-4d00-ac45-011b543edfe4" alt="A GitBook screenshot showing the OIDC integration installation"><figcaption></figcaption></figure>

サイトへのインストールが完了したら、設定に移動し、［保存］ボタンのすぐ上にあるコールバック URL を控えておきます。アイデンティティプロバイダーの設定に必要になる場合があります。

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

次の画像のようになるはずです

<figure><img src="https://4217681718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2F04b2yAGjDIJQsA2aPIEO%2FScreen%20Shot%202024-12-13%20at%203.38.30%20PM.png?alt=media&amp;token=e89e34c5-0e95-4547-a507-cc1d727b6ee5" alt="A GitBook screenshot showing the OIDC configuration screen"><figcaption></figcaption></figure>

クライアント ID とクライアントシークレットには、アイデンティティプロバイダーで取得した値を貼り付けます。

次に、アイデンティティプロバイダーの認可エンドポイントとアクセストークンエンドポイントを見つける必要があります。Google の場合、これらは `https://accounts.google.com/o/oauth2/v2/auth` 、 `https://oauth2.googleapis.com/token` です。

{% hint style="info" %}
Google を使用していない場合、これらのエンドポイントは異なります。お使いのアイデンティティプロバイダーのドキュメントを参照して、これらのエンドポイントを確認してください
{% endhint %}

OAuth スコープについても、その値はアイデンティティプロバイダーによって異なります。Google の場合は、次を入力できます `openid`.

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

Save を押します。

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

### PKCE を有効にする

アイデンティティプロバイダーが PKCE を必要とする、または推奨する場合は、 **PKCE を使用** を OIDC インテグレーションの設定画面でオンにします。このオプションは、インテグレーションが認証プロバイダーと開始する認可コードフローに対して、Proof Key for Code Exchange (PKCE) を有効にします。


---

# 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.
