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

feat(cli): add browser logout step #20502

Merged
merged 2 commits into from
Jun 25, 2024
Merged

Conversation

abdallahmz
Copy link
Contributor

@abdallahmz abdallahmz commented Jun 12, 2024

What does it do?

We perform a proper OIDC logout by opening the logout endpoint in the browser. We provide the client ID and token. We do nothing if an error happens during the logout process: the logout happens at least on the app level, this just adds a logout on the Auth0 SSO level.

"chore" changes (unrelated to the initial task):

  • Handle errors while fetching the config

Why is it needed?

This change is needed to address the issue where users are unable to switch between different login providers. By logging out the user from the OIDC provider, the user's session is cleared. This allows the user to choose a different login provider when they attempt to log in again.

How to test it?

First, use the login command:
Log in in the CLI using one of the login providers (e.g., Google),

Then, log out (using the logout command):
The CLI should open the OIDC provider's logout URL in a browser.

Try to log in again. You should be able to choose a different login provider.

7a95c833-d2d8-4060-b5b4-35d24b2f911d

Copy link

vercel bot commented Jun 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
contributor-docs ❌ Failed (Inspect) Jun 24, 2024 3:11pm

@abdallahmz abdallahmz force-pushed the feature/cloud-cli-proper-logout branch from 0c5c9e7 to 5c85e7b Compare June 17, 2024 08:47
@abdallahmz abdallahmz added source: cli Source is cli package pr: enhancement This PR adds or updates some part of the codebase or features labels Jun 17, 2024
Comment on lines 127 to 131
logger.error(
"🥲 Oops! Couldn't retrieve the cloud CLI config from the server. Please try again."
);

throw error;
Copy link
Member

Choose a reason for hiding this comment

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

wouldn't this log two errors in the user's terminal if the action is try..catching this ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it could output something like:

  • "🥲 Oops! Couldn't retrieve the cloud CLI config from the server. Please try again."
  • "Login action failed."

Copy link
Member

Choose a reason for hiding this comment

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

Could we only have one log for UX ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, if it's too much details for the error log level (or if we have a "one error line max per command" rule), I'll output it to debug instead

Copy link
Member

@nathan-pichon nathan-pichon left a comment

Choose a reason for hiding this comment

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

lgtm

was missing for staging environment. Had it in base url during local dev.
@abdallahmz abdallahmz merged commit 768a45e into develop Jun 25, 2024
151 of 152 checks passed
@abdallahmz abdallahmz deleted the feature/cloud-cli-proper-logout branch June 25, 2024 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: enhancement This PR adds or updates some part of the codebase or features source: cli Source is cli package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants