Renew Your Sign-In
A sign-in lasts 14 days by default (adjustable withOAUTH_TTL_DAYS), and using difyctl doesn’t extend it. After that, every command that uses your sign-in fails with auth_expired (exit code 4) until you sign in again. To see when yours expires, check expires_at in your sessions.
ACCESS_TOKEN_EXPIRE_MINUTES and REFRESH_TOKEN_EXPIRE_DAYS don’t change how long a difyctl sign-in lasts. They set how long a sign-in to the Dify web console lasts.login again. It signs you out first, then starts the new sign-in. If the new sign-in fails, you stay signed out until one succeeds.
Use Several Servers or Accounts
Each config folder holds one sign-in, and a new sign-in replaces it. To switch servers, runlogin with the new --server. To switch accounts, run login and approve it in a browser signed in to Dify as the other account.
To stay signed in to several at once, give each sign-in its own folder with DIFY_CONFIG_DIR, and set it on every command that uses it:
Where Your Token Lives
difyctl keeps your token in the OS keychain, under the service name difyctl: Keychain on macOS, Credential Manager on Windows, and Secret Service on Linux.
It writes the token to tokens.yml in the config folder instead, when:
- You sign in with
--no-keyring. - You’re on Linux with no desktop session bus (
DBUS_SESSION_BUS_ADDRESSis unset). - The keychain can’t be used when you sign in.
Keep
tokens.yml out of container images, backups you share, and version control.- macOS:
~/.config/difyctl - Linux:
$XDG_CONFIG_HOME/difyctl, or~/.config/difyctlifXDG_CONFIG_HOMEis unset - Windows:
%APPDATA%\difyctl
DIFY_CONFIG_DIR.
Sign Out
Runlogout when you’re done with a machine:
logout ends your session on the server and deletes your token and saved sign-in from this machine. If the server can’t be reached, logout still clears this machine, but the session stays valid on the server until it expires or you end it.
See and End Your Sessions
To see where you’re signed in, list your sessions:id, the machine’s hostname as device_label, and when it expires as expires_at.
To end a session on another machine, such as one you no longer have, delete it by ID. Pick it by device_label, so you don’t end the session on the machine you’re using.
logout instead: deleting it by ID leaves your saved sign-in behind, and your next command fails with auth_expired.