> ## 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 向けに Timesheet API を構築します。この API では、従業員または契約社員の timesheet エントリを追加できます。

また、API を使って外部システムの timesheet エントリを一元化された timesheet データベースに取り込む cron job も構築します。

<Info>
  ### 要点

  * Auth0 は、API endpoint へのアクセスを保護する手段として、API の authentication と authorization を提供します ([API Authentication and Authorization](/docs/ja-jp/get-started/architecture-scenarios/server-application-api/part-1#api-authentication-and-authorization) を参照)
  * Machine-to-Machine Application (CLI、サービス、デーモンなど、ユーザー操作を伴わないもの) の authorization には、Auth0 はクライアントクレデンシャルグラントをサポートしています ([Client Credentials Grant](/docs/ja-jp/get-started/architecture-scenarios/server-application-api/part-1#client-credentials-grant) を参照)
  * Machine-to-Machine Application と API の両方を Auth0 Dashboard で設定する必要があります ([Auth0 Configuration](/docs/ja-jp/get-started/architecture-scenarios/server-application-api/part-2) を参照)
  * API は、呼び出し時に有効な access token (JSON Web トークンとして実装されます) が HTTP Authorization header で渡されるようにすることで保護されます ([Implement the API](/docs/ja-jp/get-started/architecture-scenarios/server-application-api/part-3) を参照)
  * authorization に成功すると、Machine-to-Machine Application に access token が発行されます ([Get an access token](/docs/ja-jp/get-started/architecture-scenarios/server-application-api/part-3#get-an-access-token) を参照)
  * その後、Machine-to-Machine Application はこの access token を HTTP Authorization header として渡し、API endpoint への呼び出しを authentication できます ([Invoke the API](/docs/ja-jp/get-started/architecture-scenarios/server-application-api/part-3#invoke-the-api) を参照)
</Info>

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

ExampleCo はコンサルティング系のスタートアップ企業です。現在、従業員は約 100 名おり、加えて外部の契約業者にも業務を委託しています。従業員と外部契約業者は全員、毎週タイムシートを提出する必要があります。そのため、同社はタイムシート用のアプリケーションを構築しました。これは、[Single Sign-On for Regular Web Apps](/docs/ja-jp/get-started/architecture-scenarios/sso-for-regular-web-apps) で取り上げたシナリオです。社内の従業員はこの web app を使ってタイムシートを入力しますが、外部契約業者の中には、すでに別のツールでタイムシートを管理している人もいます。ExampleCo は、この二度手間を避けるためのソリューションを必要としており、外部システムからタイムシート エントリを読み取り、API を使って ExampleCo のバックエンドに自動でアップロードする cron job を構築することにしました。

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

ExampleCo は、次のことを実現できる柔軟なソリューションの構築を目指しています。

* バックエンドで動作する自動化プロセスに対応できること
* モバイルアプリケーションのような将来的なアプリケーションのローンチをアーキテクチャに組み込めること
* Timesheets API の安全性を確保し、認可されたユーザーとアプリケーションがアクセスできること
* アプリケーションのコードや業務ロジックの大部分を、他のアプリでも共有できること

<div id="learn-more">
  ## 詳しく見る
</div>

* [ソリューション概要 (Server Apps + API)](/docs/ja-jp/get-started/architecture-scenarios/server-application-api/part-1)
* [Auth0 の設定 (Server Apps + API)](/docs/ja-jp/get-started/architecture-scenarios/server-application-api/part-2)
* [アプリケーションの実装 (Server Apps + API)](/docs/ja-jp/get-started/architecture-scenarios/server-application-api/part-3)
* [まとめ (Server Apps + API)](/docs/ja-jp/get-started/architecture-scenarios/server-application-api/part-4)
