🔐auth0-dpop
- プラグイン
- auth0
- ライセンス
- Apache-2.0
- ソース
- GitHub で見る ↗
説明
次のような場合に使用: 盗まれても再利用されない、特定の端末や利用者に紐付けられたアクセストークン(認証情報)で API の呼び出しを保護するために、DPoP(デバイスの所有を証明する仕組み)のトークンバインディング機能を追加する場合。また、ユーザーが「トークンをクライアントに紐付ける」「トークンの盗難を防ぐ」「利用者に限定されたトークン」といった内容を求めている場合も対象です。
原文を表示
Use when adding DPoP (Demonstrating Proof-of-Possession) token binding to protect API calls with device-bound, sender-constrained access tokens that cannot be replayed if stolen. Also use when a user says "bind tokens to the client", "prevent token theft", or "sender-constrained tokens".
ユースケース
- ✓トークン盗難時の再利用を防ぐとき
- ✓特定端末・利用者に紐付けたい場合
- ✓APIコール保護を強化するとき
- ✓DPoPトークンバインディング機能を追加するとき
本文(日本語訳)
Auth0 DPoP ガイド
アクセストークンをクライアント側の暗号化キーに紐付けることで、盗まれたトークンが悪用されるのを防ぎます。
概要
DPoP とは
DPoP(所有権の証明)は RFC 9449 で定義された OAuth 2.0 の仕組みで、アクセストークンをクライアント側で保有する鍵ペアに暗号的に紐付けます。各 API リクエストには有効期限の短い署名付き JWT(DPoP プルーフと呼ぶ)が含まれ、リクエスト送信者が秘密鍵を持っていることを証明します。これにより、盗まれたトークンだけでは攻撃者による再利用ができなくなります。
このスキルを使う場合
- 重要度の高い API 呼び出しをトークン盗難と再利用攻撃から守りたい
- 送信者に紐付いたトークン(送信者制約トークン)を義務付けるセキュリティ・コンプライアンス要件を満たす必要がある
- セキュリティ要件が高い SPA(単一ページアプリケーション)や Vanilla JS アプリから Auth0 の保護された API を呼び出す
このスキルを使わない場合
- SSR / サーバーサイド環境 — DPoP はブラウザ内で保有される秘密鍵に依存するため、サーバーサイド(Next.js、Nuxt など)では安全に使用できません
- DPoP に非対応の API — リソースサーバー(API を提供するサーバー)が DPoP トークン形式に対応するよう設定されている必要があります。ベアラートークン(標準的なトークン形式)のみ対応の API は DPoP プルーフを拒否します
- トークン共有が必要なフロー — DPoP トークンは単一の鍵ペアに紐付けられており、別のクライアントに転送したり再利用したりできません
必須要件
- DPoP 対応の認可サーバーを備えた Auth0 テナント
- DPoP トークン形式が有効になっているリソースサーバー
- 次のいずれかの Auth0 SDK を使用するブラウザ SPA:
@auth0/auth0-vue、@auth0/auth0-react、@auth0/auth0-angular、@auth0/auth0-spa-js - 本番環境では HTTPS(Auth0 が DPoP の使用に必須)
主な概念
| 概念 | 説明 |
|---|---|
| DPoP プルーフ | 各リクエストに添付される有効期限の短い署名付き JWT で、鍵の保有を証明します |
| DPoP ノンス | サーバーから発行される値で、プルーフに含める必要があり、再利用を防ぎます |
useDpop: true |
SDK オプション。DPoP プルーフの自動生成を有効にします |
createFetcher() |
SDK ヘルパー関数。fetch 互換の関数を返し、プルーフ生成を自動で処理します |
UseDpopNonceError |
サーバーがリクエスト途中でノンスを更新した場合に発生するエラー。新しいノンスでリトライしてください |
ステップ 1: API で DPoP を有効にする
Auth0 ダッシュボード経由
- Applications → APIs に移動
- SPA が呼び出す API を選択
- Settings タブで、API 識別子(API identifier)が
audienceと一致することを確認 - ダッシュボード側の追加設定は不要です — DPoP はリソースサーバーが DPoP トークン形式に対応するよう設定されている場合、クライアント側がリクエストごとに有効にします
Auth0 CLI 経由
# リソースサーバーの現在の設定を確認
auth0 api get "resource-servers" | jq '.[] | select(.identifier == "https://your-api-identifier")'
# API で DPoP トークン形式を有効化
auth0 api patch "resource-servers/{API_ID}" \
--data '{"token_dialect": "access_token_authz"}'
{API_ID}は上記の GET コマンドで返された ID に置き換えてください。
ステップ 2: アプリケーションを設定する
全フレームワーク共通のパターン
- Auth0 クライアント設定またはプロバイダー設定に
useDpop: trueをaudienceと一緒に追加 - トークンを手動で添付する代わりに
createFetcher()を使用 — SDK がプルーフ生成、ノンス管理、ヘッダー注入をすべて処理します - サーバーがノンスを更新する場合に
UseDpopNonceErrorを処理
環境変数
.env に API の audience を設定してください:
# Vite
VITE_AUTH0_DOMAIN=your-tenant.auth0.com
VITE_AUTH0_CLIENT_ID=your-client-id
VITE_AUTH0_AUDIENCE=https://your-api-identifier
追加リソース
フレームワーク別の実装例
対応する全フレームワークの完全な実装例:
- Vue.js
- React
- Angular
- auth0-spa-js(Vanilla JS)
統合ガイド
エラー処理とトラブルシューティング:
UseDpopNonceError— ノンス更新の処理方法- よくある問題
関連スキル
auth0-vue— Vue.js Auth0 統合auth0-react— React Auth0 統合auth0-angular— Angular Auth0 統合auth0-spa-js— Vanilla JS / フレームワーク非依存 SPA 統合auth0-mfa— 多要素認証
参考資料
原文(English)を表示
Auth0 DPoP Guide
Bind access tokens to the client's cryptographic key so stolen tokens cannot be replayed.
Overview
What is DPoP?
DPoP (Demonstrating Proof-of-Possession) is an OAuth 2.0 mechanism defined in RFC 9449 that cryptographically binds access tokens to a client-held key pair. Each API request includes a short-lived signed JWT (the DPoP proof) that proves the sender holds the private key — a stolen token alone cannot be replayed by an attacker.
When to Use This Skill
- Protecting high-value API calls against token theft and replay attacks
- Meeting security or compliance requirements that mandate sender-constrained tokens
- Any SPA or Vanilla JS app calling a protected Auth0 API with elevated security needs
When NOT to Use This Skill
- SSR / server-side environments — DPoP relies on a private key held in the browser; it cannot be safely used server-side (Next.js, Nuxt, etc.)
- APIs that don't support DPoP — the resource server must be configured to accept DPoP token dialect; Bearer-only APIs will reject DPoP proofs
- Flows requiring token sharing — DPoP tokens are bound to a single key pair and cannot be forwarded to or reused by another client
Requirements
- Auth0 tenant with DPoP-capable authorization server
- API resource server with DPoP token dialect enabled
- A browser SPA using one of:
@auth0/auth0-vue,@auth0/auth0-react,@auth0/auth0-angular, or@auth0/auth0-spa-js - HTTPS in production (required by Auth0 for DPoP)
Key Concepts
| Concept | Description |
|---|---|
| DPoP Proof | A short-lived signed JWT attached to each request proving key possession |
| DPoP Nonce | A server-issued value that must be included in the proof to prevent replay |
useDpop: true |
SDK option that enables automatic DPoP proof generation |
createFetcher() |
SDK helper that returns a fetch-compatible function handling proofs automatically |
UseDpopNonceError |
Error thrown when the server rotates its nonce mid-flight; retry with the new nonce |
Step 1: Enable DPoP on Your API
Via Auth0 Dashboard
- Go to Applications → APIs
- Select the API your SPA calls
- Under the Settings tab, confirm the API identifier matches your
audience - No additional toggle is needed in the dashboard — DPoP is enabled per-request by the client when the API resource server is configured to accept DPoP tokens
Via Auth0 CLI
# Inspect current resource server settings
auth0 api get "resource-servers" | jq '.[] | select(.identifier == "https://your-api-identifier")'
# Enable DPoP token dialect on the API
auth0 api patch "resource-servers/{API_ID}" \
--data '{"token_dialect": "access_token_authz"}'
Replace
{API_ID}with the ID returned from the GET call above.
Step 2: Configure Your Application
Common pattern across all frameworks
- Add
useDpop: trueto your Auth0 client/provider configuration alongside youraudience - Use
createFetcher()instead of attaching tokens manually — the SDK handles proof generation, nonce management, and header injection for you - Handle
UseDpopNonceErrorin cases where the server rotates its nonce
Environment variables
Ensure your .env includes the API audience:
# Vite
VITE_AUTH0_DOMAIN=your-tenant.auth0.com
VITE_AUTH0_CLIENT_ID=your-client-id
VITE_AUTH0_AUDIENCE=https://your-api-identifier
Additional Resources
Framework Examples
Complete implementation examples for all supported frameworks:
- Vue.js
- React
- Angular
- auth0-spa-js (Vanilla JS)
Integration Guide
Error handling and troubleshooting:
UseDpopNonceError— nonce rotation handling- Common issues
Related Skills
auth0-vue- Vue.js Auth0 integrationauth0-react- React Auth0 integrationauth0-angular- Angular Auth0 integrationauth0-spa-js- Vanilla JS / framework-agnostic SPA integrationauth0-mfa- Multi-factor authentication
References
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。