Skip to content

The open alternative to Salesforce, designed for AI.

File token chores (#4664)

Darek Desu22d17d855c8d
diff --git a/.gitignore b/.gitignore
index 59a948c8eef..61f48004879 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,6 @@
**/**/.env
.DS_Store
-.idea/workspace.xml
+/.idea
**/**/node_modules/
# yarn is the recommended package manager across the project
@@ -21,4 +21,4 @@ coverage
**/**/logs/**
-storybook-static
\ No newline at end of file
+storybook-static
diff --git a/packages/twenty-docker/prod/docker-compose.yml b/packages/twenty-docker/prod/docker-compose.yml
index 887b820c31d..810b20104a9 100644
--- a/packages/twenty-docker/prod/docker-compose.yml
+++ b/packages/twenty-docker/prod/docker-compose.yml
@@ -22,6 +22,7 @@ services:
ACCESS_TOKEN_SECRET: ${ACCESS_TOKEN_SECRET}
LOGIN_TOKEN_SECRET: ${LOGIN_TOKEN_SECRET}
REFRESH_TOKEN_SECRET: ${REFRESH_TOKEN_SECRET}
+ FILE_TOKEN_SECRET: ${FILE_TOKEN_SECRET}
depends_on:
db:
condition: service_healthy
diff --git a/packages/twenty-docs/docs/start/self-hosting/cloud-providers.mdx b/packages/twenty-docs/docs/start/self-hosting/cloud-providers.mdx
index 586f01a5f91..b217e257312 100644
--- a/packages/twenty-docs/docs/start/self-hosting/cloud-providers.mdx
+++ b/packages/twenty-docs/docs/start/self-hosting/cloud-providers.mdx
@@ -15,7 +15,7 @@ Feel free to join our discord if you need assistance.
- [Azure Container Apps](#azure-container-apps)
- [Others](#others)
-## Azure Container Apps
+## Azure Container Apps
### About
@@ -261,6 +261,7 @@ resource "azapi_update_resource" "cors" {
resource "random_uuid" "access_token_secret" {}
resource "random_uuid" "login_token_secret" {}
resource "random_uuid" "refresh_token_secret" {}
+resource "random_uuid" "file_token_secret" {}
resource "azurerm_container_app" "twenty_server" {
name = local.server_name
@@ -338,6 +339,10 @@ resource "azurerm_container_app" "twenty_server" {
name = "REFRESH_TOKEN_SECRET"
value = random_uuid.refresh_token_secret.result
}
+ env {
+ name = "FILE_TOKEN_SECRET"
+ value = random_uuid.file_token_secret.result
+ }
}
}
}
@@ -424,4 +429,4 @@ resource "azurerm_container_app" "twenty_db" {
## Others
-Please feel free to Open a PR to add more Cloud Provider options.
\ No newline at end of file
+Please feel free to Open a PR to add more Cloud Provider options.
diff --git a/packages/twenty-docs/docs/start/self-hosting/docker-compose.mdx b/packages/twenty-docs/docs/start/self-hosting/docker-compose.mdx
index 792428e1ee6..452349e5c00 100644
--- a/packages/twenty-docs/docs/start/self-hosting/docker-compose.mdx
+++ b/packages/twenty-docs/docs/start/self-hosting/docker-compose.mdx
@@ -11,24 +11,25 @@ sidebar_custom_props:
3. In your .env file, replace the three "replace_me_with_a_random_string_access" with the three random strings you just generated.
```
-ACCESS_TOKEN_SECRET=replace_me_with_a_random_string_access
-LOGIN_TOKEN_SECRET=replace_me_with_a_random_string_login
+ACCESS_TOKEN_SECRET=replace_me_with_a_random_string_access
+LOGIN_TOKEN_SECRET=replace_me_with_a_random_string_login
REFRESH_TOKEN_SECRET=replace_me_with_a_random_string_refresh
+FILE_TOKEN_SECRET=replace_me_with_a_random_string_refresh
```
4. Create a `docker-compose.yml` file from the example below.
5. Run the command `docker-compose up -d`
6. Go to http://localhost:3001 and see your docker instance.
-## Troubleshooting
+## Troubleshooting
-### Not able to login
+### Not able to login
-If you encounter errors, (not able to log into the application after inputting an email) after the inital setup, try running `docker exec -it twenty-backend-1 yarn nx database:reset` and see if that solves your issue.
+If you encounter errors, (not able to log into the application after inputting an email) after the inital setup, try running `docker exec -it twenty-backend-1 yarn nx database:reset` and see if that solves your issue.
### Cannot connect to server, running behind a reverse proxy
-Complete step three and four with :
+Complete step three and four with :
3. Add `SERVER_URL=https://<your-api-url.com>` to your `.env`
4. Uncomment `SERVER_URL=${SERVER_URL}` in your `docker-compose.yml`
@@ -76,6 +77,7 @@ services:
- ACCESS_TOKEN_SECRET=${ACCESS_TOKEN_SECRET}
- LOGIN_TOKEN_SECRET=${LOGIN_TOKEN_SECRET}
- REFRESH_TOKEN_SECRET=${REFRESH_TOKEN_SECRET}
+ - FILE_TOKEN_SECRET=${FILE_TOKEN_SECRET}
# Uncomment if behind a reverse proxy
# - SERVER_URL=${SERVER_URL}
depends_on:
diff --git a/packages/twenty-docs/docs/start/self-hosting/self-hosting.mdx b/packages/twenty-docs/docs/start/self-hosting/self-hosting.mdx
index 29044fa5858..ba0c9844b96 100644
--- a/packages/twenty-docs/docs/start/self-hosting/self-hosting.mdx
+++ b/packages/twenty-docs/docs/start/self-hosting/self-hosting.mdx
@@ -59,6 +59,8 @@ import TabItem from '@theme/TabItem';
['REFRESH_TOKEN_SECRET', '<random>', 'Secret used for the refresh tokens'],
['REFRESH_TOKEN_EXPIRES_IN', '90d', 'Refresh token expiration time'],
['REFRESH_TOKEN_COOL_DOWN', '1m', 'Refresh token cooldown'],
+ ['FILE_TOKEN_SECRET', '<random>', 'Secret used for the file tokens'],
+ ['FILE_TOKEN_EXPIRES_IN', '1d', 'File token expiration time'],
['API_TOKEN_EXPIRES_IN', '1000y', 'Api token expiration time'],
]}></OptionTable>
diff --git a/packages/twenty-server/.env.example b/packages/twenty-server/.env.example
index 4959f2e8207..186fceee095 100644
--- a/packages/twenty-server/.env.example
+++ b/packages/twenty-server/.env.example
@@ -18,8 +18,9 @@ SIGN_IN_PREFILLED=true
# ACCESS_TOKEN_EXPIRES_IN=30m
# LOGIN_TOKEN_EXPIRES_IN=15m
# API_TOKEN_EXPIRES_IN=1000y
-# REFRESH_TOKEN_EXPIRES_IN=90d
-# FRONT_AUTH_CALLBACK_URL=http://localhost:3001/verify
+# REFRESH_TOKEN_EXPIRES_IN=90d
+# FILE_TOKEN_EXPIRES_IN=1d
+# FRONT_AUTH_CALLBACK_URL=http://localhost:3001/verify
# AUTH_GOOGLE_ENABLED=false
# MESSAGING_PROVIDER_GMAIL_ENABLED=false
# CALENDAR_PROVIDER_GOOGLE_ENABLED=false
diff --git a/packages/twenty-server/.env.test b/packages/twenty-server/.env.test
index 1c2c967fd41..20bd13ac8ba 100644
--- a/packages/twenty-server/.env.test
+++ b/packages/twenty-server/.env.test
@@ -9,15 +9,16 @@ FRONT_BASE_URL=http://localhost:3001
ACCESS_TOKEN_SECRET=secret_jwt
LOGIN_TOKEN_SECRET=secret_login_tokens
REFRESH_TOKEN_SECRET=secret_refresh_token
-FILE_TOKEN_SECRET=replace_me_with_a_random_string_refresh
+FILE_TOKEN_SECRET=secret_file_token
# ———————— Optional ————————
# DEBUG_MODE=false
# SIGN_IN_PREFILLED=false
# ACCESS_TOKEN_EXPIRES_IN=30m
# LOGIN_TOKEN_EXPIRES_IN=15m
-# REFRESH_TOKEN_EXPIRES_IN=90d
-# FRONT_AUTH_CALLBACK_URL=http://localhost:3001/verify
+# REFRESH_TOKEN_EXPIRES_IN=90d
+# FILE_TOKEN_EXPIRES_IN=1d
+# FRONT_AUTH_CALLBACK_URL=http://localhost:3001/verify
# AUTH_GOOGLE_ENABLED=false
# MESSAGING_PROVIDER_GMAIL_ENABLED=false
# STORAGE_TYPE=local
diff --git a/render.yaml b/render.yaml
index f67eb839106..b0719ea46b6 100644
--- a/render.yaml
+++ b/render.yaml
@@ -32,6 +32,8 @@ services:
generateValue: true
- key: REFRESH_TOKEN_SECRET
generateValue: true
+ - key: FILE_TOKEN_SECRET
+ generateValue: true
- key: PG_DATABASE_HOST
fromService:
name: twenty_postgres