# OAUTH flow による discourse community アカウントとサードパーティCRMツールの連携：コミュニティチケット作成

**URL:** https://meta.discourse.org/t/oauth-flow-to-integrate-the-discourse-community-account-with-the-third-party-crm-tool-where-it-can-create-tickets-of-community/343092
**Category:** Development
**Tags:** webhooks, oauth2, openid-connect, rest-api, platforms
**Created:** [2024 年 12 月 18 日午前 4:32 UTC](https://meta.discourse.org/t/oauth-flow-to-integrate-the-discourse-community-account-with-the-third-party-crm-tool-where-it-can-create-tickets-of-community/343092 "2024-12-18T04:32:16Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![kekafel](https://avatars.discourse-cdn.com/v4/letter/k/bc79bd/32.png) [@kekafel](https://meta.discourse.org/u/kekafel)
#### Post date: [2024 年 12 月 18 日午前 4:32 UTC](https://meta.discourse.org/t/oauth-flow-to-integrate-the-discourse-community-account-with-the-third-party-crm-tool-where-it-can-create-tickets-of-community/343092/1 "2024-12-18T04:32:16Z")

</div>

Discourseアカウントを私のツールにあるCRMツールと統合したいのですが、以下のようなことを実現したいと考えています。

1. ユーザーは、discourseのログインIDとパスワードを使用して、私のツールにDiscourseコミュニティアカウントを追加できます。
2. Discourseは、私が送信するコールバックURLに認証コードを送信する必要があります。
3. これを使用して、Discourse APIを呼び出してコミュニティデータを取得し、チケットを作成するために使用する（アクセストークンとリフレッシュトークン）を取得したいと考えています。

---

<div class="post-metadata">

### Author: ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)
#### Post date: [2024 年 12 月 18 日午前 6:34 UTC](https://meta.discourse.org/t/oauth-flow-to-integrate-the-discourse-community-account-with-the-third-party-crm-tool-where-it-can-create-tickets-of-community/343092/2 "2024-12-18T06:34:15Z")

</div>

このドキュメントで作業することをお勧めします。

- [Use Discourse as an identity provider (SSO, DiscourseConnect)](https://meta.discourse.org/t/use-discourse-as-an-identity-provider-sso-discourseconnect/32974)
- [Create and configure an API key](https://meta.discourse.org/t/create-and-configure-an-api-key/230124)

---

<div class="post-metadata">

### Author: ![kekafel](https://avatars.discourse-cdn.com/v4/letter/k/bc79bd/32.png) [@kekafel](https://meta.discourse.org/u/kekafel)
#### Post date: [2024 年 12 月 18 日午前 6:45 UTC](https://meta.discourse.org/t/oauth-flow-to-integrate-the-discourse-community-account-with-the-third-party-crm-tool-where-it-can-create-tickets-of-community/343092/3 "2024-12-18T06:45:01Z")

</div>

@thokaさん、ありがとうございます。  
APIキーを作成および設定する：  
このドキュメントでの作業は、Discourse（コミュニティアカウント）からAPIキーを生成し、その後、API呼び出しに使用するWebアプリにそのAPIキーを手動で追加するようなものです。

- [DiscourseをIDプロバイダー（SSO、DiscourseConnect）として使用する](https://meta.discourse.org/t/use-discourse-as-an-identity-provider-sso-discourseconnect/32974)  
これも、すべての手順を正常に完了した後、トークンを返さないため、OAuthフローのニーズを満たしません。  
SSOログインにのみ役立ちます。

ユースケースをもう少し詳しく説明します。  
ユーザーは[Discourseを追加]ボタンをクリックできます。  
ユーザーがすべての権限を付与すると、DiscourseのOAuthページにリダイレクトされます。  
承認をクリックすると、DiscourseはトークンをcallbackUrlに返します。  
これを保存して、さらなるAPI呼び出しに使用します。

同じことを達成するのに役立つドキュメントはありますか？
