> 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/gong-kai/site-audience/authenticated-access/setting-up-oidc.md).

# OIDC の設定

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

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

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

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

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

Auth0 統合をインストールし、必要な設定を追加します。
{% 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="/files/bbdee95e0c57904e14f6855ee7b9dc993dfb0bbe" alt="A screenshot showing creation of an OAuth client in an identity provider"><figcaption></figcaption></figure>

「認証情報を作成」をクリックし、「OAuth クライアント ID」を選択して、タイプとして「Web Application」を選び、適切な名前を付けます。許可されたリダイレクト URI には、GitBook から取得したコールバック URL を入力します。

「作成」をクリックします。Client ID と Client Secret をメモしておいてください。GitBook で統合の設定を完了するために必要になります。

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

GitBook アプリの統合に移動し、カテゴリとして認証済みアクセスを選択して、OIDC 統合をインストールします。選択した docs サイトに OIDC 統合をインストールしてください。

<figure><img src="/files/ff8966a6b15bdf933048875d874c1a17a20c16c6" alt="A GitBook screenshot showing the OIDC integration installation"><figcaption></figcaption></figure>

サイトにインストールしたら、設定へ移動し、「Save」ボタンのすぐ上にある Callback URL をメモしてください。ID プロバイダーの設定に必要になる場合があります。

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

次の画像のように表示されるはずです

<figure><img src="/files/00ec47e5a72f384ceb98e62335052eb455fd04fa" 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 プロバイダーのドキュメントにある許可されたスコープの一覧を確認し、最も権限の少ないスコープの値を入力してください。私たちはアクセストークンをユーザーが認証済みであることを確認するためだけに使用し、それ以上の情報を取得するためには使用しません。そのため、最も権限の少ないスコープを入力するのが最善のセキュリティ推奨です。
{% endhint %}

Save を押します。

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

### PKCE を有効にする

ID プロバイダーが 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
