> ## Documentation Index
> Fetch the complete documentation index at: https://translations.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> OIDC 準拠パイプラインが Implicit Flow に与える影響について説明します。

# OIDC での Implicit Flow

export const AuthCodeBlock = ({filename, icon, language, highlight, children}) => {
  const [displayText, setDisplayText] = useState(children);
  const [copyText, setCopyText] = useState(children);
  const wrapperRef = React.useRef(null);
  useEffect(() => {
    let unsubscribe = null;
    function init() {
      if (!window.autorun || !window.rootStore) {
        return;
      }
      unsubscribe = window.autorun(() => {
        let processedChildrenForDisplay = children;
        let processedChildrenForCopy = children;
        for (const [key, value] of window.rootStore.variableStore.values.entries()) {
          const escapedKey = key.replaceAll(/[.*+?^${}()|[\]\\]/g, (String.raw)`\$&`);
          let displayValue = value;
          if (key === "{yourClientSecret}" && value !== "{yourClientSecret}") {
            displayValue = value.substring(0, 3) + "*****マスク済み*****";
          }
          processedChildrenForDisplay = processedChildrenForDisplay.replaceAll(new RegExp(escapedKey, "g"), displayValue);
          processedChildrenForCopy = processedChildrenForCopy.replaceAll(new RegExp(escapedKey, "g"), value);
        }
        setDisplayText(processedChildrenForDisplay);
        setCopyText(processedChildrenForCopy);
      });
    }
    if (window.rootStore) {
      init();
    } else {
      window.addEventListener("adu:storeReady", init);
    }
    return () => {
      window.removeEventListener("adu:storeReady", init);
      unsubscribe?.();
    };
  }, [children]);
  useEffect(() => {
    if (!wrapperRef.current) return;
    const originalWriteText = navigator.clipboard.writeText.bind(navigator.clipboard);
    let isOverriding = false;
    const handleClick = e => {
      const button = e.target.closest('[data-testid="copy-code-button"]');
      if (!button || !wrapperRef.current.contains(button)) return;
      isOverriding = true;
      navigator.clipboard.writeText = text => {
        if (isOverriding) {
          isOverriding = false;
          navigator.clipboard.writeText = originalWriteText;
          return originalWriteText(copyText);
        }
        return originalWriteText(text);
      };
      setTimeout(() => {
        if (isOverriding) {
          isOverriding = false;
          navigator.clipboard.writeText = originalWriteText;
        }
      }, 100);
    };
    const wrapper = wrapperRef.current;
    wrapper.addEventListener('click', handleClick, true);
    return () => {
      wrapper.removeEventListener('click', handleClick, true);
      if (navigator.clipboard.writeText !== originalWriteText) {
        navigator.clipboard.writeText = originalWriteText;
      }
    };
  }, [copyText]);
  return <div ref={wrapperRef}>
      <CodeBlock filename={filename} icon={icon} language={language} lines highlight={highlight}>
        {displayText}
      </CodeBlock>
    </div>;
};

従来、[Implicit Flow](/ja/docs/get-started/authentication-and-authorization-flow/implicit-flow-with-form-post) は、シークレットを安全に保存できないアプリケーションで使用されていました。現在では、このフローを使用して <Tooltip tip="アクセストークン: API へのアクセスに使用される、不透明な文字列または JWT 形式の認可クレデンシャル。" cta="用語集を表示" href="/ja/docs/glossary?term=access+tokens">アクセストークン</Tooltip> を要求することはベストプラクティスとは見なされていません。新規実装では、[Authorization Code Flow with PKCE](/ja/docs/get-started/authentication-and-authorization-flow/authorization-code-flow-with-pkce) を使用してください。ただし、Form Post レスポンスモードと組み合わせた場合、アプリケーションがユーザー認証のために <Tooltip tip="アクセストークン: API へのアクセスに使用される、不透明な文字列または JWT 形式の認可クレデンシャル。" cta="用語集を表示" href="/ja/docs/glossary?term=ID+token">IDトークン</Tooltip> のみを必要とするのであれば、Implicit Flow は簡略化されたワークフローを提供します。この場合は、[Hybrid Flow](/ja/docs/get-started/authentication-and-authorization-flow/hybrid-flow) の一部として使用されます。

認証に Implicit Flow を使用する場合、<Tooltip tip="リフレッシュトークン: ユーザーに再度ログインさせることなく、新しいアクセストークンを取得するために使用されるトークン。" cta="用語集を表示" href="/ja/docs/glossary?term=Refresh+tokens">リフレッシュトークン</Tooltip> は返されなくなります。

さらに、OIDC 準拠パイプラインは、認証リクエスト、認証レスポンス、IDトークンの構造、アクセストークンの構造といった点で Implicit Flow に影響します。

<div id="authentication-request">
  ## 認証リクエスト
</div>

<div id="legacy">
  ### レガシー
</div>

```http lines theme={null}
GET /authorize?
    response_type=token
    &scope=openid email favorite_color offline_access
    &client_id=123
    &state=af0ifjsldkj
    &redirect_uri=https://app.example.com
    &device=my-device-name
```

`offline_access` スコープを指定してリフレッシュトークンを要求する場合にのみ、`device` パラメーターが必要です。詳細については、[リフレッシュトークン](/ja/docs/secure/tokens/refresh-tokens)を参照してください。

### OIDC準拠

```http lines theme={null}
GET /authorize?
    response_type=token id_token
    &scope=openid email
    &client_id=123
    &state=af0ifjsldkj
    &nonce=jxdlsjfi0fa
    &redirect_uri=https://app.example.com
    &audience=https://api.example.com
```

* `response_type` は、アクセストークンと IDトークンの両方を受け取ることを示します。
* 暗黙的フローではリフレッシュトークンは使用できません。代わりに `prompt=none` を使用してください。詳しくは、[サイレント認証を設定する](/ja/docs/authenticate/login/configure-silent-authentication) を参照してください。
* `favorite_color` は有効なスコープではなくなりました。
* `audience` は省略可能です。
* `nonce` には、暗号学的に安全なランダム文字列を使用する必要があります。詳しくは、[暗黙的フローの使用時にリプレイ攻撃を軽減する](/ja/docs/get-started/authentication-and-authorization-flow/implicit-flow-with-form-post/mitigate-replay-attacks-when-using-the-implicit-flow) を参照してください。

<div id="authentication-response">
  ## 認証レスポンス
</div>

<div id="legacy">
  ### レガシー
</div>

```json lines theme={null}
HTTP/1.1 302 Found
Location: https://app.example.com/#
    access_token=SlAV32hkKG
    &expires_in=86400
    &state=af0ifjsldk
    &id_token=eyJ...
    &refresh_token=8xLOxBtZp8
    &token_type=Bearer
```

* 返されたアクセストークンは、[`/userinfo`](https://auth0.com/docs/api/authentication#get-user-info) エンドポイントの呼び出しに使用できます。
* リフレッシュトークンが返されるのは、`device` パラメーターが渡され、`offline_access` スコープが要求された場合のみです。

<div id="oidc-conformant">
  ### OIDC 準拠
</div>

```json lines theme={null}
HTTP/1.1 302 Found
Location: https://app.example.com/#
    access_token=eyJ...
    &expires_in=86400
    &state=af0ifjsldk
    &id_token=eyJ...
    &token_type=Bearer
```

* 返されたアクセストークンは、[`/userinfo`](https://auth0.com/docs/api/authentication#get-user-info) エンドポイントの呼び出しに使用できます (`audience` パラメータで指定した API が、[署名アルゴリズム](/ja/docs/get-started/applications/signing-algorithms) として `RS256` を使用している場合) 。また、必要に応じて、`audience` パラメータで指定した <Tooltip tip="リソースサーバー: 保護されたリソースをホストするサーバー。リソースサーバーは、保護されたリソースへのリクエストを受け取り、応答します。" cta="用語集を表示" href="/ja/docs/glossary?term=resource+server">リソースサーバー</Tooltip> の呼び出しにも使用できます。
* `response_type=id_token` を使用する場合、Auth0 は IDトークン のみを返します。
  インプリシットグラントではリフレッシュトークンは使用できません。代わりに `prompt=none` を使用してください。

<div id="id-token-structure">
  ## IDトークンの構造
</div>

<div id="legacy">
  ### レガシー
</div>

export const codeExample1 = `{
    "sub": "auth0|alice",
    "iss": "https://{yourDomain}/",
    "aud": "123",
    "exp": 1482809609,
    "iat": 1482773609,
    "email": "alice@example.com",
    "email_verified": true,
    "favorite_color": "blue"
}`;

<AuthCodeBlock children={codeExample1} language="json" filename="JSON" />

### OIDC準拠

export const codeExample2 = `{
    "sub": "auth0|alice",
    "iss": "https://{yourDomain}/",
    "aud": "123",
    "exp": 1482809609,
    "iat": 1482773609,
    "email": "alice@example.com",
    "email_verified": true,
    "https://app.example.com/favorite_color": "blue",
    "nonce": "jxdlsjfi0fa"
}`;

<AuthCodeBlock children={codeExample2} language="json" filename="JSON" />

* `favorite_color` クレームは名前空間付きである必要があり、ルールを使用して追加する必要があります。詳細については、[名前空間付きカスタムクレームを作成する](/ja/docs/secure/tokens/json-web-tokens/create-custom-claims)を参照してください。
* IDトークンの検証後、アプリケーションはリプレイ攻撃を防ぐために <Tooltip tip="Nonce: リプレイ攻撃を検出して防止するために、認証プロトコルで一度だけ発行される任意の数値。" cta="用語集を表示" href="/ja/docs/glossary?term=nonce">nonce</Tooltip> も検証する必要があります。

<div id="access-token-structure-optional">
  ## アクセストークンの構造 (任意)
</div>

<div id="legacy">
  ### レガシー
</div>

```bash HTTP lines theme={null}
SlAV32hkKG
```

返されたアクセストークンは不透明で、`/userinfo` エンドポイントの呼び出しでのみ有効です。

### OIDC準拠

export const codeExample3 = `{
    "sub": "auth0|alice",
    "iss": "https://{yourDomain}/",
    "aud": [
        "https://api.example.com",
        "https://{yourDomain}/userinfo"
    ],
    "azp": "123",
    "exp": 1482816809,
    "iat": 1482809609,
    "scope": "openid email"
}`;

<AuthCodeBlock children={codeExample3} language="json" filename="JSON" />

* 返されるアクセストークンは、`/userinfo` エンドポイントの呼び出しに使用できる <Tooltip tip="JSON Web Token (JWT): 2者間でクレームを安全にやり取りするために使用される標準のIDトークン形式（また、多くの場合はアクセストークン形式）。" cta="用語集を見る" href="/ja/docs/glossary?term=JWT">JWT</Tooltip> です (`audience` パラメーターで指定された API が [署名アルゴリズム](/ja/docs/get-started/applications/change-application-signing-algorithms) として `RS256` を使用している場合) 。また、`audience` パラメーターで指定されたリソースサーバーの呼び出しにも使用できます。
* 指定された <Tooltip tip="Audience: 発行されたトークンのオーディエンスを一意に識別する値です。トークン内では aud という名前で、その値には IDトークンの場合はアプリケーション（クライアントID）の ID、アクセストークンの場合は API（API Identifier）の ID が含まれます。" cta="用語集を見る" href="/ja/docs/glossary?term=audience">オーディエンス</Tooltip> が `/userinfo` のみである場合でも、不透明なアクセストークンが返されることがあります。

<div id="learn-more">
  ## 詳しくはこちら
</div>

* [OIDC を使用したアクセストークン](/ja/docs/authenticate/login/oidc-conformant-authentication/oidc-adoption-access-tokens)
* [OIDC を使用した外部 API](/ja/docs/authenticate/login/oidc-conformant-authentication/oidc-adoption-apis)
* [OIDC を使用した認可コードフロー](/ja/docs/authenticate/login/oidc-conformant-authentication/oidc-adoption-auth-code-flow)
* [OIDC を使用したクライアントクレデンシャルフロー](/ja/docs/authenticate/login/oidc-conformant-authentication/oidc-adoption-client-credentials-flow)
* [OIDC を使用した委任](/ja/docs/authenticate/login/oidc-conformant-authentication/oidc-adoption-delegation)
* [OIDC を使用したリフレッシュトークン](/ja/docs/authenticate/login/oidc-conformant-authentication/oidc-adoption-refresh-tokens)
