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

> Resource Owner Password Flowの仕組みと、高い信頼性が求められるアプリケーションでこれを使用すべき理由について説明します。

# Resource Owner Password Flow

<Warning>
  Resource Owner Password (ROP) Flowではアプリケーションがユーザーのパスワードを処理するため、サードパーティのクライアントで使用してはなりません。
</Warning>

推奨はしていませんが、高い信頼性が求められるアプリケーションでは、<Tooltip tip="Resource Owner: 保護されたリソースへのアクセスを許可できる主体（ユーザーやアプリケーションなど）。" cta="用語集を見る" href="/ja/docs/glossary?term=Resource+Owner">Resource Owner</Tooltip> Password Flow ([OAuth 2.0 RFC 6749, section 4.3](https://tools.ietf.org/html/rfc6749#section-4.3) で定義されており、Resource Owner Password Grant または ROPG と呼ばれることもあります) を使用できます。このフローでは通常、インタラクティブなフォームを使って、ユーザーに認証情報 (username/メールアドレス/電話番号とパスワード) の入力を求めます。認証情報はバックエンドに送信され、<Tooltip tip="Access Token: API へのアクセスに使用される、不透明な文字列または JWT 形式の認可クレデンシャル。" cta="用語集を見る" href="/ja/docs/glossary?term=Access+Token">アクセストークン</Tooltip>と交換される前に将来の利用のために保存される可能性があるため、アプリケーションがこの情報を完全に信頼できることが不可欠です。

この条件を満たしている場合でも、Resource Owner Password Flowを使用すべきなのは、リダイレクトベースのフロー ([Authorization Code Flow](/ja/docs/get-started/authentication-and-authorization-flow/authorization-code-flow) など) を利用できない場合に限られます。

<div id="how-it-works">
  ## 動作の仕組み
</div>

<Frame>
  <img src="https://mintcdn.com/translations/pvjQqAy3EB2TK6NP/docs/images/cdy7uua7fh8z/4EeYNcnVX1RFcTy5z4lP4v/c3e4d22e6f8bf558caf07338a7388097/ROP_Grant.png?fit=max&auto=format&n=pvjQqAy3EB2TK6NP&q=85&s=56a360b162a2e39f3fa33c5d9787c03d" alt="図 - Resource Owner Password Flow" width="2234" height="1330" data-path="docs/images/cdy7uua7fh8z/4EeYNcnVX1RFcTy5z4lP4v/c3e4d22e6f8bf558caf07338a7388097/ROP_Grant.png" />
</Frame>

1. ユーザーがアプリケーション内の **Login** をクリックし、認証情報を入力します。
2. アプリケーションがユーザーの認証情報を Auth0 の認可サーバー ([`/oauth/token` エンドポイント](https://auth0.com/docs/api/authentication#resource-owner-password)) に送信します。
3. Auth0 の認可サーバーが認証情報を検証します。
4. Auth0 の認可サーバーがアクセストークン (必要に応じてリフレッシュトークンも) を返します。
5. アプリケーションはアクセストークンを使用して API を呼び出し、ユーザーに関する情報にアクセスできます。
6. API が要求されたデータを返します。

<div id="how-to-implement-it">
  ## 実装方法
</div>

Resource Owner Password Flow を実装する最も簡単な方法は、API エンドポイントの使用方法を解説したチュートリアル「[Resource Owner Password Flow を使用して API を呼び出す](/ja/docs/get-started/authentication-and-authorization-flow/resource-owner-password-flow/call-your-api-using-resource-owner-password-flow)」に従うことです。

<div id="realm-support">
  ## Realm のサポート
</div>

Auth0 では、Resource Owner Password グラント と同様の機能を提供する拡張 グラント を利用できます。この グラント では、個別のユーザーディレクトリ (それぞれ別個の接続に対応) を維持したまま、フロー中に使用するディレクトリを指定できます。

たとえば、アプリケーションのログイン UI にドロップダウンを表示し、ユーザーが自分のユーザータイプとして `Employees` または `Customers` を選択できるようにしたいとします。この場合、`Employees` と `Customers` を realm として設定し (それぞれに対応する接続も設定) 、従業員と顧客の認証情報を別々のユーザーディレクトリに保持できます。トークンをリクエストするときは、ユーザーの認証情報とあわせて realm の値を送信します。送信された realm は、パスワードの検証に使用されます。

この拡張 グラント の実装の詳細については、[Call Your API Using Resource Owner Password Flow: Configure Realm Support](/ja/docs/get-started/authentication-and-authorization-flow/resource-owner-password-flow/call-your-api-using-resource-owner-password-flow) を参照してください。

<div id="rules">
  ## Rules
</div>

Rules は、Resource Owner Password Flow (Realm 拡張グラントを含む) で実行されます。ただし、リダイレクトルールは動作しません。ルールで `context.redirect` を指定してリダイレクトを実行しようとすると、認証フローでエラーが返されます。Rules の詳細については、[Auth0 Rules](/ja/docs/customize/rules) を参照してください。リダイレクトルールの詳細については、[Redirect Users from Within Rules](/ja/docs/customize/rules/redirect-users) を参照してください。

<div id="mfa-support">
  ## MFA サポート
</div>

Resource Owner Password Flow を使用する必要があり、より強固な認証が必要な場合は、<Tooltip tip="多要素認証（MFA）: username とパスワードに加えて、SMS で送信される code などの別の要素も使用するユーザー認証プロセスです。" cta="用語集を表示" href="/ja/docs/glossary?term=multi-factor+authentication">多要素認証</Tooltip> (MFA) を追加できます。詳しくは、[MFA を使用して Resource Owner Password Flow で認証する](/ja/docs/secure/multi-factor-authentication/authenticate-using-ropg-flow-with-mfa) を参照してください。

<div id="attack-protection">
  ## 攻撃対策
</div>

<Tooltip tip="ブルートフォース保護: 単一の IP アドレスから単一のユーザーアカウントを標的として行われるブルートフォース攻撃から保護する攻撃対策の一種です。" cta="用語集を表示" href="/ja/docs/glossary?term=brute-force+protection">ブルートフォース保護</Tooltip>とともに Resource Owner Password Flow を使用する場合、一部の<Tooltip tip="ブルートフォース保護: 単一の IP アドレスから単一のユーザーアカウントを標的として行われるブルートフォース攻撃から保護する攻撃対策の一種です。" cta="用語集を表示" href="/ja/docs/glossary?term=attack+protection">攻撃対策</Tooltip>機能が正常に動作しないことがあります。ただし、一般的ないくつかの問題は回避できます。詳しくは、[Resource Owner Password Flow と攻撃対策でよくある問題を回避する](/ja/docs/get-started/authentication-and-authorization-flow/resource-owner-password-flow/avoid-common-issues-with-resource-owner-password-flow-and-attack-protection)を参照してください。

<div id="learn-more">
  ## 詳細情報
</div>

* [Auth0 Rules](/ja/docs/customize/rules)
* [Auth0 Hooks](/ja/docs/customize/hooks)
* [トークン](/ja/docs/secure/tokens)
* [トークンのベストプラクティス](/ja/docs/secure/tokens/token-best-practices)
* [どの OAuth 2.0 フローを使用すべきですか？](/ja/docs/get-started/authentication-and-authorization-flow/which-oauth-2-0-flow-should-i-use)
