Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Login process in Initialization of lean folder #486

Merged

Conversation

Romazes
Copy link
Contributor

@Romazes Romazes commented Aug 14, 2024

Description

This PR introduces enhancements to the Lean CLI authentication process. Specifically, it modifies the lean init command to prompt users for authentication if their credentials are not available or invalid. Instead of throwing an exception when no user is found, the system now initiates the login process and stores the credentials in the Lean configuration file.

Key changes include:

  1. Retrieve Credentials: The get_lean_config_credentials function is used to fetch existing credentials from the Lean configuration.
  2. Prompt for Login: If credentials are missing or invalid, the get_credentials function is called to prompt the user for their user ID and API token.
  3. Validate Credentials: The validate_credentials function ensures that the provided credentials are valid and correctly authenticated.
  4. Enhanced Error Handling: The system now guides users through the login process instead of throwing an error, improving user experience and ensuring proper credential storage in the Lean configuration.

Related Issue

Closes #483

Motivation and Context

Previously, if the lean init command was run without valid credentials, the system would raise an exception with the message Error: User not found: None, which was not user-friendly and could be confusing.

This update improves the user experience by:

  • Automatically prompting for login credentials if they are not found.
  • Storing valid credentials in the Lean configuration to avoid repeated logins.
  • Providing clear guidance to users on obtaining and configuring their credentials.

By integrating these changes, we aim to streamline the setup process and reduce friction for users getting started with the Lean CLI.

How Has This Been Tested?

Manual Testing

  • Ran the lean login command to ensure that the login process is functioning as expected and has not introduced any issues.
  • Executed the lean init command to verify that it correctly prompts for login credentials when they are missing or invalid, and that it successfully initiates the login process.

image

@Romazes Romazes self-assigned this Aug 14, 2024
Copy link
Member

@Martin-Molinero Martin-Molinero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! 👍

@Martin-Molinero Martin-Molinero merged commit 5848527 into QuantConnect:master Aug 15, 2024
28 checks passed
@Romazes Romazes deleted the fix-483-lean-init-user-not-found branch September 17, 2024 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lean init Error: User not found: None
2 participants