-
Notifications
You must be signed in to change notification settings - Fork 988
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
feat(cli/api): more descriptive api errors & CLI warning when using token auth while being logged in #2445
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove the errors specific to CLI and keeps the generic ones
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Backend changes look good but for CLI, a better approach is to make use of PersistentPreRun
function in the root CMD. You can call a function there and it will get run by every child command.
What we want to check for is if there is a token over ride either from --token flag or from environment. If we see them being set we can show the message. Here is a example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made minor adjustment to the error warning message and removed the comments. Let’s only add comments for very nuanced logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
source
would be better set as a enum of sorts because now the get token function is tightly coupled with the warning logic but this is fine for now
Description 📣
API:
This PR adds more descriptive error messages for certain errors. Specifically we are now formatting JWT-related errors, so they're more understandable for the end users.
CLI:
We are now checking if the user is using user-based auth, and token based auth at the same time. If the user is using both token-based and user-based authentication, we will display a warning letting the user know that the token-based auth is being used.
This has been confusing users in the past, so this aims to add more clarity which authentication method is being used.
After talking to @maidul98, this seemed like something we'd want to keep on the API-end, instead handling directly in the CLI codebase.
Type ✨