Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion docs/docs/Develop/api-keys-and-authentication.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,45 @@ If your flows use the File System component, also follow [Move shared files when
4. Set `LANGFLOW_AUTO_LOGIN=false`, set `LANGFLOW_SUPERUSER` to the existing account's username, and set `LANGFLOW_SUPERUSER_PASSWORD` before restarting or upgrading. Startup requires this setting, but it does **not** overwrite a non-legacy password on an existing account. Use the password established in the previous steps.
5. Start the new release with the existing database and configuration directory. In a fresh browser session, sign in with the established password and verify that your existing flows are present.

Do not delete the existing account, database, or encryption key to regain access. Creating a different superuser does not transfer ownership of the existing account's flows. If you upgraded before preparing the account, use an existing administrator credential to update that account's password; if none is available, complete the preparation on a backed-up previous installation restricted to local access before upgrading again.
Do not delete the existing account, database, or encryption key to regain access. Creating a different superuser does not transfer ownership of the existing account's flows. If you already upgraded without preparing the account, see [Recover access after upgrading](#recover-access-after-upgrading).

An explicit `LANGFLOW_AUTO_LOGIN=true` in an existing environment or `.env` file takes precedence over the new default. Remove that override or set it to `false` as part of the transition. Disabling auto-login prevents new anonymous sessions; it does not revoke previously issued sessions or API keys.

##### Recover access after upgrading {#recover-access-after-upgrading}

If you upgraded without preparing the account, Langflow starts but you can't sign in to the account that owns your flows.
That account uses a generated bootstrap password that you never saw, and `LANGFLOW_SUPERUSER_PASSWORD` doesn't replace it.
Your flows are still in the database.
To recover them, temporarily re-enable auto-login and set a password on that same account:

1. Back up the database and configuration directory.
2. Stop Langflow. Set `LANGFLOW_AUTO_LOGIN=true` in the environment or `.env` file, then start Langflow with the same database and configuration directory. Keep the instance restricted to trusted local access until you finish.
3. Request an auto-login token, and copy the `access_token` value from the response:

```bash
curl -s http://localhost:7860/api/v1/auto_login
```

4. Get the account's ID, and copy the `id` value from the response:

```bash
curl -s http://localhost:7860/api/v1/users/whoami \
-H "Authorization: Bearer ACCESS_TOKEN"
```

5. Set a strong password on that account. Don't use the legacy default value `langflow`. Read the password into a variable so that it isn't stored in your shell history, and avoid `"` and `\` characters, which break the JSON body.

```bash
read -rs NEW_PASSWORD
curl -s -X PATCH http://localhost:7860/api/v1/users/USER_ID \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"password\": \"$NEW_PASSWORD\"}"
```

6. Stop Langflow. Remove `LANGFLOW_AUTO_LOGIN=true` or set it to `false`. If the account's username isn't `langflow`, set `LANGFLOW_SUPERUSER` to it. Set `LANGFLOW_SUPERUSER_PASSWORD` to the password from step 5. Startup requires this variable, but it doesn't overwrite the password you just set.
7. Start Langflow, sign in with that username and password, and verify that your existing flows are present.

#### LANGFLOW_SKIP_AUTH_AUTO_LOGIN {#langflow-skip-auth-auto-login}

When `LANGFLOW_AUTO_LOGIN=true`, set `LANGFLOW_SKIP_AUTH_AUTO_LOGIN=true` to also skip authentication for API requests.
Expand Down
7 changes: 7 additions & 0 deletions docs/docs/Get-Started/get-started-installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,13 @@ To install a specific version of the Langflow package, add the required version

To reinstall Langflow and all of its dependencies, run `uv pip install langflow --force-reinstall`.

:::warning Upgrading from an auto-login installation
Langflow 1.13 disables auto-login by default.
Before you upgrade an installation that signs in automatically, [prepare the existing account for password sign-in](/api-keys-and-authentication#upgrade-from-auto-login).
If you already upgraded and can't sign in, see [Recover access after upgrading](/api-keys-and-authentication#recover-access-after-upgrading).
Don't delete or reinstall Langflow to regain access, because that can permanently remove your flows.
:::

:::note Langflow 1.12 package migration
The new runnable `langflow-base` package starts at version `1.12.0` and stays
version-aligned with `langflow`. Requirements such as
Expand Down
18 changes: 18 additions & 0 deletions docs/docs/Support/troubleshooting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,24 @@ If you're experiencing this issue, update your Langflow installation to version
uv pip install langflow -U
```

### Can't sign in after upgrading from an auto-login installation {#cant-sign-in-after-upgrade}

Langflow 1.13 disables auto-login by default.
After you upgrade an installation that signed in automatically, one of the following can occur:

* Startup exits with `Username and password must be set`.
* Langflow starts, but sign-in fails with `Incorrect username or password` even after you set `LANGFLOW_SUPERUSER_PASSWORD`.
* The sign-up page creates a new account that doesn't have your existing flows.

Your flows are still in the database. They belong to the account that auto-login used, which has a generated password that `LANGFLOW_SUPERUSER_PASSWORD` doesn't replace.

To resolve this issue:

1. If startup exits, set `LANGFLOW_SUPERUSER_PASSWORD` before you start Langflow.
2. If sign-in still fails, follow [Recover access after upgrading](/api-keys-and-authentication#recover-access-after-upgrading).

Don't delete the database or reinstall Langflow to regain access, because that can permanently remove your flows.

## Langflow MCP issues {#mcp}

The following issues can occur when using Langflow as an MCP server or client.
Expand Down
7 changes: 6 additions & 1 deletion src/backend/base/langflow/services/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,12 @@ async def setup_superuser(settings_service: SettingsService, session: AsyncSessi
await logger.adebug(f"Setup superuser: username={username}, has_password={bool(password)}")

if not username or not password:
msg = "Username and password must be set"
msg = (
"Username and password must be set. "
"Set LANGFLOW_SUPERUSER_PASSWORD before starting Langflow. "
"If you are upgrading an existing auto-login installation, "
"see https://docs.langflow.org/next/api-keys-and-authentication#upgrade-from-auto-login"
)
await logger.aerror(f"Missing credentials: username={username}, password={'set' if password else 'not set'}")
raise ValueError(msg)

Expand Down
5 changes: 4 additions & 1 deletion src/backend/tests/unit/test_setup_superuser_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,12 @@ async def test_setup_superuser_with_no_configured_credentials_fails_closed(initi
settings.auth_settings.SUPERUSER_PASSWORD = ""

async with session_scope() as session:
with pytest.raises(ValueError, match="Username and password must be set"):
with pytest.raises(ValueError, match="Username and password must be set") as exc_info:
await setup_superuser(settings, session)

assert "LANGFLOW_SUPERUSER_PASSWORD" in str(exc_info.value)
assert "api-keys-and-authentication#upgrade-from-auto-login" in str(exc_info.value)


@pytest.mark.parametrize("username", [DEFAULT_SUPERUSER, "custom_admin"])
@pytest.mark.asyncio
Expand Down
Loading