

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 在 FHIR 探索文件上擷取 SMART
<a name="reference-smart-on-fhir-discovery-document"></a>

SMART 定義探索文件，可讓用戶端了解 HealthLake 資料存放區支援的授權端點 URLs和功能。此資訊可協助用戶端將授權請求導向正確的端點，並建構 HealthLake 資料存放區支援的授權請求。

若要讓用戶端應用程式成功向 HealthLake 提出 FHIR REST 請求，必須收集 HealthLake 資料存放區定義的授權要求。*不需要*承載字符 （授權），此請求才能成功。

**請求 HealthLake 資料存放區的探索文件**  


1. 收集 HealthLake `region`和 `datastoreId` 值。如需詳細資訊，請參閱[取得資料存放區屬性](managing-data-stores-describe.md)。

1. 使用 HealthLake `region`和 的收集值來建構請求的 URL`datastoreId`。附加`/.well-known/smart-configuration`至 URL 的端點。若要在下列範例中檢視整個 URL 路徑，請捲動至**複製**按鈕。

   ```
   https://healthlake.region.amazonaws.com/datastore/datastoreId/r4/.well-known/smart-configuration
   ```

1. 使用 `GET` 搭配 [AWS Signature 第 4 版](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv.html)簽署通訊協定來傳送請求。若要檢視整個範例，請捲動至**複製**按鈕。

------
#### [ curl ]

   ```
   curl --request GET \
     'https://healthlake.region.amazonaws.com/datastore/datastoreId/r4/.well-known/smart-configuration \
     --aws-sigv4 'aws:amz:region:healthlake' \
     --user "$AWS_ACCESS_KEY_ID:$AWS_SECRET_ACCESS_KEY" \
     --header "x-amz-security-token:$AWS_SESSION_TOKEN" \
     --header 'Accept: application/json'
   ```

------

   HealthLake 資料存放區的探索文件會傳回為 JSON blob，您可以在其中找到 `authorization_endpoint`和 `token_endpoint`，以及資料存放區的規格和定義功能。

   ```
   {
       "authorization_endpoint": "https://oidc.example.com/authorize",
       "token_endpoint": "https://oidc.example.com/oauth/token",
       "capabilities": [
           "launch-ehr",
           "client-public"
       ]
   }
   ```

   `token_endpoint` 需要 `authorization_endpoint`和 才能啟動用戶端應用程式。
   + **授權端點** — 授權用戶端應用程式或使用者所需的 URL。
   + **權杖端點** — 用戶端應用程式用來與之通訊的授權伺服器端點。