Skip to content

fix(auth): update code/token generation from CLI and redirect to successful page#518

Open
eduardoRoth wants to merge 7 commits intomainfrom
fix/eroth/auth-update
Open

fix(auth): update code/token generation from CLI and redirect to successful page#518
eduardoRoth wants to merge 7 commits intomainfrom
fix/eroth/auth-update

Conversation

@eduardoRoth
Copy link
Member

Changes required by https://github.com/neverendingsupport/eol-report-card/pull/350 to allow users to keep their authenticated session on the web app after a successful authentication from the CLI.

This PR changes the flow for the code and token generation. Before the local server was stopped after the code from keycloak was received, sending a text/pain response, and generating the tokens after that.

The new flow generates the code, then the tokens and, after getting them, it redirects to a page on the eol-report-card web app that handles the creation of the session cookie.

@eduardoRoth eduardoRoth requested a review from a team as a code owner March 18, 2026 08:28
@eduardoRoth eduardoRoth force-pushed the fix/eroth/auth-update branch from c4afd3c to db76111 Compare March 18, 2026 08:32
Copy link
Contributor

@jeremymwells jeremymwells left a comment

Choose a reason for hiding this comment

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

LGTM.

Is there no way to test this?

@eduardoRoth
Copy link
Member Author

@jeremymwells , you can pull this branch and the branch of #350 from eol-report-card project and run the following commands:

  1. eol-report-card npm run dev
  2. cli
    1. npm run dev auth login
    2. npm run dev scan eol

You need to add to your cli .envrc file the property EOL_LOG_IN_URL

@jeremymwells
Copy link
Contributor

@eduardoRoth - fair point. I meant automated tests. Also, macos, ubuntu, and windows node version tests should pass, right?

@eduardoRoth
Copy link
Member Author

@jeremymwells whoops, sorry, i thought you wanted to test it.
Yeah, I'm fixing the failing tests right now

res.end();
resolve(token);
})
.catch((error) => reject(error))
Copy link
Member

@marco-ippolito marco-ippolito Mar 19, 2026

Choose a reason for hiding this comment

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

I think we need to refactor this function as its complexity is very high. Can we try to break it into smaller functions? Mixing async await and then catch syntax produces unexpected results. (for example the .catch is not catching rejections from an awaited promise), its better to avoid this pattern completely, given that we are also in another new promise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants