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

> モバイルアプリケーションが API と通信するアーキテクチャシナリオについて説明します。

# API を利用するモバイルアプリケーション

このシナリオでは、ExampleCo という架空の企業向けにタイムシート API を構築します。この API では、従業員または契約社員のタイムシートエントリを管理できます。

また、API を使用して一元化されたタイムシートデータベース内のタイムシートエントリを表示および記録するモバイルアプリケーションも構築します。

<Info>
  ### 要点

  * Auth0 は、API エンドポイントへのアクセスを保護する手段として、API の認証と認可を提供します ([API Authentication and Authorization](/ja/docs/get-started/architecture-scenarios/mobile-api/part-1#api-authentication-and-authorization) を参照)
  * モバイルアプリのユーザーを認可して API へのアクセスを付与するために、Auth0 は [Authorization Code Flow with Proof Key for Code Exchange (PKCE)](/ja/docs/get-started/authentication-and-authorization-flow/authorization-code-flow-with-pkce) をサポートしています ([Proof Key for Code Exchange](/ja/docs/get-started/architecture-scenarios/mobile-api/part-1#proof-key-for-code-exchange-pkce-) を参照)
  * モバイルアプリと API の両方を Auth0 Dashboard で設定する必要があります ([Auth0 Configuration](/ja/docs/get-started/architecture-scenarios/mobile-api/part-2) を参照)
  * Authorization Extension を使用して、ユーザー Permissions を適用できます ([Configure the Authorization Extension](/ja/docs/get-started/architecture-scenarios/mobile-api/part-2#configure-the-authorization-extension) を参照)
  * API の呼び出し時に、有効な <Tooltip tip="" cta="用語集を表示" href="/ja/docs/glossary?term=Access+Token">アクセストークン</Tooltip> が HTTP Authorization ヘッダーで渡されるようにすることで、API を保護できます ([Implement the API](/ja/docs/get-started/architecture-scenarios/mobile-api/part-3#secure-the-endpoints) を参照)
  * Auth0.Android SDK を使用すると、モバイルアプリのユーザーを認可し、API の呼び出しに使用できる有効なアクセストークンを取得できます ([Authorize the User](/ja/docs/get-started/architecture-scenarios/mobile-api/part-3#authorize-the-user) を参照)
  * モバイルアプリでは、IDトークンをデコードしてユーザーのユーザープロフィール情報を取得できます ([Get the User Profile](/ja/docs/get-started/architecture-scenarios/mobile-api/part-3#get-the-user-profile) を参照)
  * ユーザーに付与されたスコープに基づいて、UI 要素を条件付きで表示できます ([Display UI Elements Conditionally Based on Scope](/ja/docs/get-started/architecture-scenarios/mobile-api/part-3#display-ui-elements-conditionally-based-on-scope) を参照)
  * モバイルアプリは、API の呼び出し時に HTTP Authorization ヘッダーでアクセストークンを渡します ([Call the API](/ja/docs/get-started/architecture-scenarios/mobile-api/part-3#call-the-api) を参照)
  * セッション中にユーザーが再度ログインしなくて済むように、モバイルアプリユーザーのアクセストークンを更新できます ([Renew the Token](/ja/docs/get-started/architecture-scenarios/mobile-api/part-3#renew-the-token) を参照)
</Info>

<div id="the-premise">
  ## 前提
</div>

ExampleCo はコンサルティング系のスタートアップ企業です。現在、従業員は約 100 名おり、いくつかの業務を外部の契約業者に委託しています。すべての従業員と外部の契約業者は、毎週タイムシートを記入する必要があります。

同社はタイムシートアプリケーションを構築しており、このシナリオについては [通常の Web アプリ向けシングルサインオン](/ja/docs/get-started/architecture-scenarios/sso-for-regular-web-apps) で取り上げました。社内の従業員はこの Web アプリを使ってタイムシートを記入していますが、会社は、社外にいる従業員や契約業者が利用できるモバイルアプリケーションを必要としています。このアプリは、タイムシートエントリを記録し、API を使用してそのデータを集中管理されたタイムシートデータベースに送信するために使用されます。また、マネージャーがタイムシートエントリを承認できるようにもなります。

<div id="goals-requirements">
  ### 目標と要件
</div>

ExampleCo は、柔軟なソリューションを構築したいと考えています。タイムシートエントリを記録できる複数の従業員や契約社員が存在する可能性があるほか、外部システムからタイムシートエントリをアップロードするバッチプロセスも想定されます。

そのため同社は、このモバイルアプリだけでなく、ほかのすべてのアプリでも時間を記録できるよう、単一の Timesheets API を開発することを決定しました。これに対応できる十分に柔軟なセキュリティアーキテクチャを導入したいと考えています。また、アプリケーションのコードとビジネスロジックの大部分を、異なるアプリケーション間で共有できるようにしたいと考えています。

認可されたユーザーとアプリケーションのみが Timesheets API にアクセスできる必要があります。

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

* [ソリューション概要 (モバイルアプリ + API) ](/ja/docs/get-started/architecture-scenarios/mobile-api/part-1)
* [Auth0の設定 (モバイルアプリ + API) ](/ja/docs/get-started/architecture-scenarios/mobile-api/part-2)
* [API とモバイルアプリの設定 (モバイルアプリ + API) ](/ja/docs/get-started/architecture-scenarios/mobile-api/part-3)
* [Node.js API の実装 (モバイルアプリ + API) ](/ja/docs/get-started/architecture-scenarios/mobile-api/api-implementation-nodejs)
* [Android モバイルアプリの実装 (モバイルアプリ + API) ](/ja/docs/get-started/architecture-scenarios/mobile-api/mobile-implementation-android)
* [結論 (モバイルアプリ + API) ](/ja/docs/get-started/architecture-scenarios/mobile-api/part-4)
