> For the complete documentation index, see [llms.txt](https://docs-embed.anyflow.jp/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-embed.anyflow.jp/recipe/accounting/freee-custom-oauth.md).

# freeeコネクタのスコープを変更する

## 概要

Anyflow Embed のウィザードでコネクタの認証を行う際、OAuthによる認証方式をとっているコネクタでは許可するスコープ（権限）が表示されます。

<figure><img src="https://files.readme.io/64e3da9-image.png" alt="例：freee会計コネクタのスコープ" width="400"><figcaption><p>例：freee会計コネクタのスコープ</p></figcaption></figure>

基本的には、このスコープは変更することなく様々なアクションを実行できるようになっていますが、スコープを広げる・狭めることも可能です。このページでは、スコープを調整する方法についてご説明します。

## 手順

対象のSaaSによって詳細は異なりますが、大まかに共通する流れは以下のとおりです。

1. 対象のSaaSにおいて、開発者ポータルなどから独自のアプリを作成します
2. 作成したアプリの Client ID と Client Secret をAnyflow CSチームに共有します
3. Anyflow側で設定を行うと、独自のアプリを通じた認証が行えるようになります

{% hint style="success" %}

### アプリ配布の制限

SaaSの開発者ポータルでアプリを使用する場合は基本的にはスムーズにアプリを使用できることが多い一方で、第三者へアプリ提供を行う場合には審査等の手続きが必要な場合があります。

詳しくは各SaaSの開発者ポータルをご確認ください。
{% endhint %}

今回は例として、開発者向けにfreee会計コネクタのスコープを調整する方法をご紹介します。

### 1. 独自アプリの作成

### 1-1. 開発者アカウントの作成

以下のページのステップ1を参照して、開発者アカウントを作成します。

<https://developer.freee.co.jp/startguide#1-%e3%82%bb%e3%83%83%e3%83%88%e3%82%a2%e3%83%83%e3%83%97>

#### 1-2. アプリの作成

以下のページを参照して、独自のアプリを作成します。

<https://developer.freee.co.jp/startguide/starting-api>

コールバックURLには以下を設定します。

```
https://for-product-api.anyflow.jp/oauth2/callback
```

アプリの Client ID / Secret を控えておきます。

#### 1-3. スコープの設定

以下のページを参照して、アプリに許可するスコープを設定します。

<https://developer.freee.co.jp/startguide/deploy-app#%e6%a8%a9%e9%99%90%e8%a8%ad%e5%ae%9a%e3%82%92%e8%a1%8c%e3%81%86>

今回は **\[会計] 勘定科目 の参照** のみを許可します。

<figure><img src="https://files.readme.io/eb5fb01-image.png" alt="" width="375"><figcaption></figcaption></figure>

### 2. Client ID / Secret の共有

Anyflow CSチームに以下の情報を共有します。

* 対象のコネクタ（今回は「freee会計コネクタ」）
* Client ID
* Client Secret

### 3. Anyflowでの設定

Anyflow側での設定が完了すると、スコープが変更されたコネクタを利用できるようになります。

<figure><img src="https://files.readme.io/25833ad-image.png" alt="" width="375"><figcaption></figcaption></figure>

{% hint style="warning" %}

### ソリューションエディタのヘルプテキストは変更されません

ソリューションエディタでカスタムアクションを選んだ際に表示されるヘルプテキストにはAnyflowがデフォルトで設定したスコープが記載されています。

現時点では、独自アプリによるスコープ変更を行ったとしてもこのヘルプテキストは変更されません。
{% endhint %}

<figure><img src="https://files.readme.io/8c4fafb-image.png" alt="カスタムアクションのヘルプテキスト" width="400"><figcaption><p>カスタムアクションのヘルプテキスト</p></figcaption></figure>

### 4. アプリの公開を行う

公開用のアプリを作成する場合は以下の手順で実施します。freeeの場合は審査が必要となります。

<https://developer.freee.co.jp/startguide/deploy-app>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs-embed.anyflow.jp/recipe/accounting/freee-custom-oauth.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
