[AEM Forms]{class="badge positive" title="適用於AEM Forms)。"}

OAuth伺服器對伺服器驗證

OAuth伺服器對伺服器驗證允許以權杖為基礎的安全存取AEM Forms Communications API,而不需要使用者互動。 Adobe Developer Console支援OAuth伺服器對伺服器驗證。

先決條件

開始之前,請確定符合下列必要條件:

如何使用OAuth伺服器對伺服器驗證產生存取權杖?

請依照下列步驟,從Adobe Developer主控台產生存取權杖,並透過OAuth伺服器對伺服器驗證發出第一個API呼叫。

​1. Adobe Developer Console專案設定

  1. 導覽至Adobe Developer Console

  2. 使用您的Adobe ID登入

  3. 建立新專案或導覽至您現有的專案

若要建立新專案
  1. 在​ 快速入門 ​區段中,按一下​建立新專案

  2. 使用預設名稱建立新專案

    建立ADC專案

  3. 按一下右上角的​編輯專案

    編輯專案

  4. 提供有意義的名稱(例如「formsproject」)

  5. 按一下「儲存

    編輯專案名稱

To navigate to your existing project
  1. Click All Projects from the Adobe Developer Console

    Search Projects

  2. Locate your project and click to open it.

    Locate Projects

2. Add Forms APIs

Add Forms APIs based on what you want to do:

  • AEM Forms Communications APIs: use when you need to generate, convert, assemble, or secure documents (PDF and related formats).
  • Adaptive Forms Runtime APIs – use when you need to render, submit, or process Adaptive Forms at runtime.
For AEM Forms Communications APIs
  1. Click Add API

    Add api

  2. Select Forms Communication APIs

    1. In the Add API dialog, filter by Experience Cloud

    2. Select "Forms Communication APIs"

      Add Forms Communication API

    3. 按一下「下一步」。

    4. Select OAuth Server-to-Server authentication method

      Select Authentication method

For Adaptive Forms Runtime APIs
  1. Click Add API

    Add api

  2. Select AEM Forms Delivery and Runtime API

    1. In the Add API dialog, filter by Experience Cloud

    2. Select "AEM Forms Delivery and Runtime API"
      Add Forms Communication API

    3. 按一下「下一步」。

    4. Select OAuth Server-to-Server authentication method.
      Select Authentication method

You can also add the API and authentication method to your existing project by clicking Add to Project > API
Add API to existing Project

3. Add Product Profile

Product profile provides permissions (or authorization) for credentials to access the AEM resources.

  1. Select the Product Profile that matches your AEM instance URL (https://Service Type -Environment Type-Program XXX-Environment XXX.adobeaemcloud.com).

    • Service Type – specifies services or permissions associated with the AEM instance

    • Environment Type – specifies whether the envrionment is for Author or Publish service

    • Program XXX – identifies the Cloud Manager program ID

    • Environment XXX – identifies the specific environment ID within that program

    note note
    NOTE
    Product profiles are tied to a specific AEM instance (program + environment). Always choose the profile that matches your instance URL.
  2. 按一下​「儲存已設定的 API」。 The API and Product Profile are added to your project

    Select Project Configuration

4. Generate and Save Credentials

  1. Navigate to your project in Adobe Developer Console

  2. Click OAuth Server-to-Server credential

  3. View the Credential details section

    View Credentials

Record API Credentials

    API Credentials:
    ================
    Client ID: <your_client_id>
    Client Secret: <your_client_secret>
    Technical Account ID: <tech_account_id>
    Organization ID: <org_id>
    Scopes: AdobeID,openid,read_organizations

5. Access Token Generation

Generate the Access token either manually or programmatically:

For Testing

Generate access tokens manually in Adobe Developer Console:

  1. 瀏覽至您的專案

    1. 在Adobe Developer Console中,開啟您的專案
    2. 按一下​OAuth伺服器對伺服器
  2. 產生存取權杖

    1. 按一下專案API區段中的​ 「產生存取權杖」 ​按鈕
    2. 複製產生的存取權杖

    產生存取權杖

    note note
    NOTE
    存取權杖僅對​ 24小時 ​有效
用於生產

使用Adobe IMS API以程式設計方式產生權杖:

必要的認證:

  • 用戶端 ID
  • 用戶端密碼
  • 範圍(通常: openid, AdobeID, read_organizations, additional_info.projectedProductContext, read_pc.dma_aem_cloud, aem.document

權杖端點:

code language-none
https://ims-na1.adobelogin.com/ims/token/v3

範例要求(curl):

code language-bash
curl -X POST 'https://ims-na1.adobelogin.com/ims/token/v3' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'grant_type=client_credentials' \
-d 'client_id=<YOUR_CLIENT_ID>' \
-d 'client_secret=<YOUR_CLIENT_SECRET>' \
-d 'scope=AdobeID,openid,read_organizations'

回應:

code language-json
    {
    "access_token": "eyJhbGciOiJSUz...",
    "token_type": "bearer",
    "expires_in": 86399
    }

您現在可以使用產生的存取Token針對開發、預備或生產環境進行API呼叫。

最佳實務:管理開發、測試和生產的認證

  • 請一律使用開發、測試和生產的個別認證。

  • 將每個認證對應至正確的AEM環境URL。

  • 安全地儲存秘密,並且絕不將其提交至原始檔控制。

  • 追蹤存取權杖有效性,因為權杖僅在24小時內有效。

後續步驟

若要瞭解如何設定同步Forms通訊API的環境,請參閱AEM Forms as a Cloud Service通訊同步處理

相關文章

瞭解如何設定同步(隨選)和非同步(批次) Forms Communications API的環境:

同步API

AEM Forms Communications API — 同步

瞭解如何設定同步(隨選) Forms Communications API的環境,以便立即產生或處理檔案。

進一步瞭解

非同步API

AEM Forms Communications API — 非同步(批次)

瞭解如何為非同步(批次) Forms Communications API設定環境,以排程方式產生或處理多個檔案。

進一步瞭解

recommendation-more-help
fbcff2a9-b6fe-4574-b04a-21e75df764ab