> ## 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 では、従業員または契約社員の勤怠エントリを追加できます。

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

<Info>
  ### 要点

  * Auth0 は、API エンドポイントへのアクセスを保護する手段として、API の認証と認可を提供します ([API Authentication and Authorization](/ja/docs/get-started/architecture-scenarios/server-application-api/part-1#api-authentication-and-authorization) を参照)
  * Machine-to-Machine Application (CLI、サービス、またはデーモンなど、ユーザー操作を伴わないもの) を認可するために、Auth0 は Client Credentials grant をサポートしています ([Client Credentials Grant](/ja/docs/get-started/architecture-scenarios/server-application-api/part-1#client-credentials-grant) を参照)
  * Machine-to-Machine Application と API の両方を Auth0 Dashboard で設定する必要があります ([Auth0 Configuration](/ja/docs/get-started/architecture-scenarios/server-application-api/part-2) を参照)
  * API は、呼び出し時に有効なアクセストークン (JSON Web Token として実装されます) が HTTP Authorization ヘッダーで渡されるようにすることで保護されます ([Implement the API](/ja/docs/get-started/architecture-scenarios/server-application-api/part-3) を参照)
  * 認可に成功すると、Machine-to-Machine Application にアクセストークンが発行されます ([Get an access token](/ja/docs/get-started/architecture-scenarios/server-application-api/part-3#get-an-access-token) を参照)
  * Machine-to-Machine Application は、このアクセストークンを HTTP Authorization ヘッダーとして渡すことで、API エンドポイントの呼び出しを認証できます ([Invoke the API](/ja/docs/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](/ja/docs/get-started/architecture-scenarios/sso-for-regular-web-apps) で取り上げたシナリオです。社内の従業員はこの Web アプリを使ってタイムシートを入力していますが、外部契約業者の中には、すでに別のツールでタイムシートを管理している人もいます。ExampleCo はこうした二重作業を避けるため、外部システムから勤怠エントリを読み取り、API を使って ExampleCo のバックエンドへ自動的にアップロードする cron ジョブを構築することにしました。

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

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

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

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

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