

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# OAuth 2.0 を使用して Amazon OpenSearch Ingestion パイプラインを Atlassian Jira または Confluence に接続する
<a name="configure-client-atlassian-OAuth2-setup"></a>

このトピックの情報は、OAuth 2.0 認証を使用して Amazon OpenSearch Ingestion パイプラインを設定して Jira または Confluence アカウントに接続するのに役立ちます。が Atlassian Services で OpenSearch Ingestion パイプラインを使用するための [前提条件](configure-client-atlassian.md#atlassian-prerequisites) を完了し、API キー認証情報を使用しない場合は、このタスクを実行します。

**Topics**
+ [OAuth 2.0 統合アプリケーションを作成する](#create-OAuth2-integration-app)
+ [Atlassian Developer アクセストークンの生成と更新](#generate-and-refresh-jira-access-token)

## OAuth 2.0 統合アプリケーションを作成する
<a name="create-OAuth2-integration-app"></a>

次の手順を使用して、Atlassian Developer ウェブサイトで OAuth 2.0 統合アプリケーションを作成します。

**OAuth 2.0 統合アプリケーションを作成するには**

1. [https://developer.atlassian.com/console/myapps/](https://developer.atlassian.com/console/myapps/) で Atlassian Developer アカウントにログインします。

1. **[作成]**、**[OAuth 2.0 統合]** を選択します。

1. **[名前]** には、アプリケーションの目的を識別する名前を入力します。

1. 次に、**[Atlassian の開発者規約に同意する]** チェックボックスをオンにして **[作成]** を選択します。

1. 左側のナビゲーションで、**[認可]** を選択し、**[追加]** を選択します。

1. **[コールバック URL]** には、**https://www.amazon.com** や **https://www.example.com** などの任意の URL を入力し、**[変更を保存]** を選択します。

1. 左側のナビゲーションで、**[アクセス許可]** ページを選択し、Jira API の行で **[追加]** を選択し、**[構成]** を選択します。すべての Classic Scopes Read のアクセス許可 (以下のリストを参照) をすべて選択し、[保存] を選択します。

1. **[きめ細かいスコープ]** タブを選択し、**[スコープを編集]** を選択して **[Jira API を編集]** ダイアログボックスを開きます。

1. 使用しているソースプラグインのアクセス許可を選択します。

------
#### [ Jira ]

   ```
   read:audit-log:jira
   read:issue:jira
   read:issue-meta:jira
   read:attachment:jira
   read:comment:jira
   read:comment.property:jira
   read:field:jira
   read:field.default-value:jira
   read:field.option:jira
   read:field-configuration-scheme:jira
   read:field-configuration:jira
   read:issue-link:jira
   read:issue-link-type:jira
   read:issue-link-type:jira
   read:issue.remote-link:jira
   read:issue.property:jira
   read:resolution:jira
   read:issue-details:jira
   read:issue-type:jira
   read:issue-worklog:jira
   read:issue-field-values:jira
   read:issue.changelog:jira
   read:issue.transition:jira
   read:issue.vote:jira
   read:jira-expressions:jira
   ```

------
#### [ Confluence ]

   ```
   read:content:confluence
   read:content-details:confluence
   read:space-details:confluence
   read:audit-log:confluence
   read:page:confluence
   read:blogpost:confluence
   read:custom-content:confluence
   read:comment:confluence
   read:space:confluence
   read:space.property:confluence
   read:space.setting:confluence
   read:content.property:confluence
   read:content.metadata:confluence
   read:task:confluence
   read:whiteboard:confluence
   read:app-data:confluence
   manage:confluence-configuration
   ```

------

1. **[保存]** を選択します。

関連情報については、Atlassian Developer ウェブサイトの「[Implementing OAuth 2.0 (3LO)](https://developer.atlassian.com/cloud/oauth/getting-started/implementing-oauth-3lo/)」と「[Determining the scopes required for an operation](https://developer.atlassian.com/cloud/oauth/getting-started/determining-scopes/)」を参照してください。

## Atlassian Developer アクセストークンの生成と更新
<a name="generate-and-refresh-jira-access-token"></a>

Atlassian Developer ウェブサイトで Atlassian Developer アクセストークンを生成および更新するには、次の手順を使用します。

**Jira アクセストークンを生成して更新するには**

1. [https://developer.atlassian.com/console/myapps/](https://developer.atlassian.com/console/myapps/) で Atlassian Developer アカウントにログインします。

1. 「[OAuth 2.0 統合アプリケーションを作成する](#create-OAuth2-integration-app)」で作成したアプリを選択します。

1. 左側のナビゲーションメニューで **[認可]** を選択します。

1. ページの下部から Atlassian API 認可 URL の値をコピーし、任意のテキストエディタに貼り付けます。

   URL の形式は次のとおりです。

   ```
   https://auth.atlassian.com/authorize?
   audience=api.atlassian.com 
   &client_id=YOUR_CLIENT_ID
   &scope=REQUESTED_SCOPE%20REQUESTED_SCOPE_TWO
   &redirect_uri=https://YOUR_APP_CALLBACK_URL
   &state=YOUR_USER_BOUND_VALUE 
   &response_type=code
   &prompt=consent
   ```

1. `state=YOUR_USER_BOUND_VALUE` については、パラメータ値を state=「**sample\$1text**」など、任意の値に変更します。

   詳細については、Atlassian Developer ウェブサイトの「[What is the state parameter used for?](https://developer.atlassian.com/cloud/jira/platform/oauth-2-3lo-apps/#what-is-the-state-parameter-used-for-)」を参照してください。

1. `scope` セクションには、前のタスクで選択した詳細なスコープが一覧表示されていることに注意してください。例: `scope=read%3Ajira-work%20read%3Ajira-user%20offline_access`

   `offline_access` は、`refresh_token` を生成することを示します。

1. ウェブブラウザウィンドウを開き、コピーした認可 URL をブラウザウィンドウのアドレスバーに入力します。

1. ターゲットページが開いたら、情報が正しいことを確認し、**[承認]** を選択すると、Jira または Confluence のホームページにリダイレクトされます。

1. ホームページがロードされたら、このページの URL をコピーします。URL にはお使いのアプリケーション用の認証コードが含まれています。このコードを使用してアクセストークンを生成します。`code=` の後のセクション全体が認証コードです。

1. アクセストークンを生成するには、次の cURL コマンドを使用します。*プレースホルダー値*を、ユーザー自身の情報に置き換えます。
**ヒント**  
Postman などのサードパーティーサービスを使用することもできます。

   ```
   curl --request POST --url 'https://auth.atlassian.com/oauth/token' \
   --header 'Content-Type: application/json' \
   --data '{"grant_type": "authorization_code",
   "client_id": "YOUR_CLIENT_ID",
   "client_secret": "YOUR_CLIENT_SECRET",
   "code": "AUTHORIZATION_CODE",
   "redirect_uri": "YOUR_CALLBACK_URL"}'
   ```

   このコマンドへのレスポンスには、`access_code` と `refresh_token` の値が含まれます。