You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/Configuration/configuration-authentication.md
+64-96Lines changed: 64 additions & 96 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,149 +4,117 @@ sidebar_position: 0
4
4
slug:/configuration-authentication
5
5
---
6
6
7
+
The login functionality in Langflow serves to authenticate users and protect sensitive routes in the application.
7
8
9
+
Starting from version 0.5, Langflow introduces an enhanced login mechanism that is governed by a few environment variables. This allows new secure features.
8
10
9
-
:::info
11
+
##Create a superuser and new users in Langflow
10
12
11
-
This page may contain outdated information. It will be updated as soon as possible.
13
+
Learn how to create a new superuser, log in to Langflow, and add new users.
12
14
13
-
:::
14
-
15
-
16
-
17
-
18
-
##Sign Up and Sign In {#f480dac5d2094d75a433de0b8e195641}
19
-
20
-
21
-
---
15
+
1. Create a`.env` file and open it in your preferred editor.
22
16
17
+
2. Add the following environment variables to your file.
23
18
24
-
The login functionality in Langflow serves to authenticate users and protect sensitive routes in the application. Starting from version 0.5, Langflow introduces an enhanced login mechanism that is governed by a few environment variables. This allows new secure features.
The following environment variables are crucial in configuring the login settings:
31
-
32
-
-_`LANGFLOW_AUTO_LOGIN`_: Determines whether Langflow should automatically log users in. Default is`True`.
33
-
-_`LANGFLOW_SUPERUSER`_: The username of the superuser.
34
-
-_`LANGFLOW_SUPERUSER_PASSWORD`_: The password for the superuser.
35
-
-_`LANGFLOW_SECRET_KEY`_: A key used for encrypting the superuser's password.
36
-
-_`LANGFLOW_NEW_USER_IS_ACTIVE`_: Determines whether new users are automatically activated. Default is`False`.
19
+
```bash
20
+
LANGFLOW_AUTO_LOGIN=False
21
+
LANGFLOW_SUPERUSER=admin
22
+
LANGFLOW_SUPERUSER_PASSWORD=securepassword
23
+
LANGFLOW_SECRET_KEY=randomly_generated_secure_key
24
+
LANGFLOW_NEW_USER_IS_ACTIVE=False
25
+
```
37
26
38
-
All of these variables can be passed to the CLI command_`langflow run`_ through the_`--env-file`_ option. For example:
27
+
For more information, see[Authentication configuration values](#values).
39
28
29
+
:::tip
30
+
The Langflow project includes a[`.env.example`](https://github.com/langflow-ai/langflow/blob/main/.env.example) file to help you get started.
31
+
You can copy the contents of this file into your own`.env` file and replace the example values with your own preferred settings.
32
+
:::
40
33
41
-
```shell
42
-
langflow run --env-file .env
34
+
3. Save your`.env` file.
35
+
4. Run Langflow with the configured environment variables.
43
36
37
+
```bash
38
+
python -m langflow run --env-file .env
44
39
```
45
40
41
+
5. Sign in with your username`admin` and password`securepassword`.
42
+
6. To open the**Admin Page**, click your user profile image, and then select**Admin Page**.
43
+
You can also go to`http://127.0.0.1:7861/admin`.
44
+
7. To add a new user, click**New User**, and then add the**Username** and**Password**.
45
+
8. To activate the new user, select**Active**.
46
+
The user can only sign in if you select them as**Active**.
47
+
9. To give the user`superuser` priveleges, click**Superuser**.
48
+
10. Click**Save**.
49
+
11. To confirm your new user has been created, sign out of Langflow, and then sign back in using your new**Username** and**Password**.
46
50
47
-
:::caution
51
+
##Manage Superuser with the Langflow CLI
48
52
49
-
It is critical not to expose these environment variables in your code repository. Always set them securely in your deployment environment,forexample, using Docker secrets, Kubernetes ConfigMaps/Secrets, or dedicated secure environment configuration systems like AWS Secrets Manager.
53
+
Langflow provides a command-line utilityforinteractively creating superusers:
50
54
55
+
1. Enter the CLI command:
51
56
52
-
:::
57
+
```bash
58
+
langflow superuser
59
+
```
60
+
2. Langflow prompts you for a**Username** and**Password**:
53
61
62
+
```
63
+
langflow superuser
64
+
Username: new_superuser_1
65
+
Password:
66
+
Default folder created successfully.
67
+
Superuser created successfully.
68
+
```
54
69
70
+
3. To confirm your new superuser was created successfully, go to the**Admin Page** at`http://127.0.0.1:7861/admin`.
|`LANGFLOW_SECRET_KEY`| Key for encrypting superuser password| -|
82
+
|`LANGFLOW_NEW_USER_IS_ACTIVE`| Automatically activates new users|`False`|
59
83
60
-
By default, this variable is set to`True`. When enabled (`True`), Langflow operates as it did in versions prior to 0.5—automatic login without requiring explicit user authentication.
84
+
###LANGFLOW_AUTO_LOGIN
61
85
86
+
By default, this variable is set to`True`. When enabled, Langflow operates as it did in versions prior to 0.5, including automatic login without requiring explicit user authentication.
62
87
63
88
To disable automatic login and enforce user authentication:
64
89
65
-
66
90
```shell
67
91
export LANGFLOW_AUTO_LOGIN=False
68
92
```
69
93
94
+
###LANGFLOW_SUPERUSER and LANGFLOW_SUPERUSER_PASSWORD
These environment variables are only relevant when`LANGFLOW_AUTO_LOGIN` is set to`False`. They specify the username and password for the superuser, which is essential for administrative tasks.
75
-
76
-
96
+
These environment variables are only relevant when LANGFLOW_AUTO_LOGIN is set to False. They specify the username and password for the superuser, which is essential for administrative tasks.
77
97
To create a superuser manually:
78
98
79
-
80
-
```shell
99
+
```bash
81
100
export LANGFLOW_SUPERUSER=admin
82
101
export LANGFLOW_SUPERUSER_PASSWORD=securepassword
83
102
```
84
103
85
-
86
-
You can also use the CLI command`langflow superuser` to set up a superuser interactively.
This environment variable holds a secret key used for encrypting the superuser's password. Make sure to set this to a secure, randomly generated string.
By default, this variable is set to`False`. When enabled (`True`), new users are automatically activated and can log in without requiring explicit activation by the superuser.
105
-
106
-
107
-
##Manage superusers with the CLI {#3b0c36a5cc0f4acc95c884d3de858d46}
108
-
109
-
110
-
Langflow provides a command-line utility for managing superusers:
111
-
112
-
113
-
```shell
114
-
langflow superuser
115
110
```
116
111
112
+
###LANGFLOW_NEW_USER_IS_ACTIVE
117
113
118
-
This command prompts you to enter the username and password for the superuser, unless they are already set using environment variables.
119
-
120
-
121
-
##Sign in {#736ebb8c854b4c268d5e748c119a08ea}
122
-
123
-
124
-
With_`LANGFLOW_AUTO_LOGIN`_ set to_`False`_, Langflow requires users to sign up before they can log in. The sign-up page is the default landing page when a user visits Langflow for the first time.
Once signed in, you can change your profile settings by clicking on the profile icon in the top right corner of the Langflow dashboard. This opens a dropdown menu with the following options:
134
-
135
-
-**Admin Page**: Opens the admin page, which is only accessible to the superuser.
136
-
-**Profile Settings**: Opens the profile settings page.
137
-
-**Sign Out**: Logs the user out.
138
-
139
-

140
-
141
-
142
-
Select**Profile Settings** to change your password and your profile picture.
143
-
114
+
By default, this variable is set to`False`. When enabled, new users are automatically activated and can log in without requiring explicit activation by the superuser.
144
115
145
-

146
116
147
117
148
-
Select**Admin Page** to manage users and groups as the superuser.