bugfix: langflow application losing store api-key on refresh page/backend (#2960)

* changing api key journey

* refactor(api_key.py): remove unnecessary code related to config_dir and secret_key_path
refactor(login.py): refactor setting api_key cookie to use user's store_api_key
refactor(variable/service.py): re-encrypt stored value if secret_key changes to ensure validity

* 📝 (api_key.py): Remove unused imports and clean up code for better readability
📝 (login.py): Remove unused imports and clean up code for better readability
📝 (auth/utils.py): Remove unused imports and clean up code for better readability
📝 (store/service.py): Remove unused imports and clean up code for better readability

* 🔧 (utils.py): replace hashing logic with random key generation for key length less than 32 bytes to ensure key length is always 32 bytes
📝 (utils.py): update comments for clarity and accuracy regarding key generation and encryption process

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
This commit is contained in:
Cristhian Zanforlin Lousa 2024-07-25 19:05:38 -03:00 • committed by GitHub
commit b6774cf3d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 44 additions and 2 deletions

View file

@ -117,7 +117,6 @@ export function AuthProvider({ children }): React.ReactElement {
}
function storeApiKey(apikey: string) {
cookies.set(LANGFLOW_API_TOKEN, apikey, { path: "/" });
setApiKey(apikey);
}