mirror of
https://github.com/langgenius/dify-docs.git
synced 2026-07-22 20:36:31 -04:00
2f88f0f7d2
* docs: add Human Input file inputs and Service API to Cloud docs Port the Phase 2 Human Input docs (file inputs and the Service API integration flow) to the Cloud docs, mirroring the self-host pages. - human-input.mdx (en/zh/ja): add the Single File / File List field type and the file-handling notes; the upload-limit callout states Cloud's fixed limits (documents 15 MB, images 10 MB, audio 50 MB, video 100 MB, up to 10 files) instead of self-host env vars. - hitl-api-integration-flow.mdx (en/zh/ja): new; identical to self-host since the Service API is the same. - docs.json: nest the integration-flow under the Human Input group in all three navs. - zh/ja reuse the self-host translations; only the callout and the /self-host/ links changed. * docs: rewrite Cloud model providers around AI Credits * docs: rewrite Cloud subscription management for 1.15.0 * docs: update Cloud code node limits and XLSX image extraction note * docs: rewrite Cloud team members management for 1.15.0 * docs: apply the 1.15.0 Integrations redesign to Cloud docs * docs: fix workflow API reference for run-level logs and streaming * docs: sync self-host use-dify pages and fix translation debt * docs: align shared tutorials and quick start with 1.15.0 * docs: refine difyctl install examples and workspace reference * docs: rewrite hotkeys page to match current shortcuts * fix: correct broken anchor links for badged headings and tabs * fix: correct env link and Human Input resume identifier * feat: handle heading badges in link-checker slugs * fix: repoint publish-mcp cross-links to the merged MCP section * docs: rename plugin dev CLI to Dify Plugin CLI * docs: refine CLI reference readability and expand --agent * feat: stop format checkers flagging indented list-item content * fix: correct zh/ja custom-endpoint spacing and a list blank line * docs: clarify Cloud model provider install and AI Credits coverage
111 lines
5.2 KiB
Plaintext
111 lines
5.2 KiB
Plaintext
---
|
||
title: 認証
|
||
description: CLI から Dify ホストにサインインし、token の保存場所を確認し、セッションを管理する
|
||
---
|
||
|
||
> このドキュメントは AI によって自動翻訳されています。不正確な部分がある場合は、[英語版](/en/cli/authenticate) を参照してください。
|
||
|
||
サインインは OAuth 2.0 デバイスフローを使ってブラウザ経由で行います。`difyctl` がパスワードを受け取ることはありません。
|
||
|
||
## サインイン
|
||
|
||
<Steps>
|
||
<Step title="ログインコマンドの実行">
|
||
|
||
Dify ホストの URL を渡します。Dify Cloud の場合は `https://cloud.dify.ai` を、セルフホスト環境では [コンソール API URL](/ja/self-host/deploy/configuration/environments#console_api_url) を使用します。
|
||
|
||
```bash
|
||
difyctl auth login --host https://cloud.dify.ai
|
||
```
|
||
|
||
`difyctl` はワンタイムコードを表示し、既定のブラウザで検証 URL を開いて待機します。
|
||
|
||
```text
|
||
! Copy this one-time code: WDJP-XKLM
|
||
Open: https://cloud.dify.ai/device
|
||
```
|
||
<Tip>
|
||
自動で開かないようにするには、`--no-browser` を渡します。
|
||
</Tip>
|
||
|
||
ブラウザが開かない場合(SSH 経由やヘッドレスセッションでは通常の動作です)、任意のデバイスで URL を自分で開きます。
|
||
</Step>
|
||
|
||
<Step title="ブラウザでのサインイン承認">
|
||
開いたブラウザタブで、Dify の認証情報を使ってサインインし、ワンタイムコードを入力します。
|
||
|
||
コードは 15 分後に失効します。失効した場合は、`difyctl auth login` を再実行して新しいコードを取得します。
|
||
</Step>
|
||
|
||
<Step title="セッションの確認">
|
||
ターミナルに戻ります。
|
||
|
||
```text
|
||
✓ Logged in to cloud.dify.ai as <your-email> (<your-name>)
|
||
Workspace: <your-workspace>
|
||
```
|
||
|
||
2 行目に表示されているのがワークスペースです。
|
||
</Step>
|
||
</Steps>
|
||
|
||
## 再サインイン
|
||
|
||
コマンドが `auth_expired`(終了コード 4)で失敗した場合、サーバー側でセッションが失効または取り消されています。
|
||
|
||
`difyctl auth login` をもう一度実行します。先にサインアウトする必要はなく、新しいサインインによって保存済みの token が更新されます。
|
||
|
||
## サインイン中のアカウントの確認
|
||
|
||
```bash
|
||
difyctl auth whoami
|
||
```
|
||
|
||
```text
|
||
<your-email> (<your-name>)
|
||
```
|
||
|
||
スクリプトから ID 情報を読み取るには、`--json` を追加します。
|
||
|
||
```bash
|
||
difyctl auth whoami --json
|
||
```
|
||
|
||
同じフィールドが JSON オブジェクトとして返され、さらにアカウント ID も含まれます。
|
||
|
||
```json
|
||
{"id":"3c90c3cc-0d44-4b50-8888-8dd25736052a","email":"<your-email>","name":"<your-name>"}
|
||
```
|
||
|
||
## サインアウト
|
||
|
||
```bash
|
||
difyctl auth logout
|
||
```
|
||
|
||
```text
|
||
✓ Logged out of cloud.dify.ai
|
||
```
|
||
|
||
これによりサーバー上のセッションが取り消され、token とセッションエントリがマシンから削除されます。サーバー側の取り消しに失敗した場合でも、ローカルの認証情報は必ず消去されます。
|
||
|
||
## Token の保存場所
|
||
|
||
サインインすると OAuth bearer token が保存されます。`dfoa_` プレフィックスで識別できます。この token はあなた自身を表すため、アカウントがワークスペースでできる操作は、そのまま CLI からも実行できます。
|
||
|
||
`difyctl` は、オペレーティングシステムの認証情報ストアが利用できる場合はそこに token を保存します。macOS では Keychain、Windows では Credential Manager、Linux では Secret Service です。利用できる認証情報ストアがない場合は、`difyctl` 設定ディレクトリ内のパーミッション `0600` の `tokens.yml` ファイルにフォールバックします。
|
||
|
||
`difyctl` はサインイン時に一度ストアを選択し、以降のセッションはそれを使用します。セッションのメタデータ(ホスト、アカウント、ワークスペース)は token とともに `hosts.yml` に保存されます。
|
||
|
||
設定ディレクトリは、macOS と Linux では `~/.config/difyctl`(Linux は `XDG_CONFIG_HOME` に従います)、Windows では `%APPDATA%\difyctl` です。[`DIFY_CONFIG_DIR`](/ja/cli/reference/environment-variables) を設定すると、この場所を上書きできます。
|
||
|
||
## トラブルシューティング
|
||
|
||
| 問題 | 対処方法 |
|
||
|:---|:---|
|
||
| ブラウザがまったく開かない | ターミナルから URL をコピーし、任意のデバイスで開く。 |
|
||
| ホストが拒否される | 受け付けるのは `https://` ホストのみ。スキームのないホストは `https://` として扱われる。プレーンな `http://` ホスト(ローカル開発のみ)の場合は、`--insecure` を追加する。 |
|
||
| 後続のコマンドが `auth_expired` で失敗する | セッションが失効または取り消された。[再サインイン](#再サインイン) する。 |
|
||
|
||
その他の問題については、[トラブルシューティング](/ja/cli/troubleshooting) ページ全体を参照してください。
|