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

Auth command #253

Merged
merged 16 commits into from
Sep 19, 2024
Merged

Auth command #253

merged 16 commits into from
Sep 19, 2024

Conversation

filip-debricked
Copy link
Collaborator

@filip-debricked filip-debricked commented Aug 29, 2024

Adds initial auth command with 3 subcommands:

  • login (authenticates the user by opening debricked.com and sending back token and then saving credentials locally)
  • logout (removes saved credentials)
  • token (returns the saved credentials, if they exist, and refreshes credentials if needed)

In the future the other CLI commands which needs a token will use the saved credentials if a token is not specifically provided.

This is the initial version of the command, and there will be some changes to the backend before we can utilise it fully.

@filip-debricked filip-debricked requested a review from zozs August 29, 2024 12:08
@filip-debricked filip-debricked self-assigned this Aug 29, 2024
@sweoggy sweoggy marked this pull request as draft September 3, 2024 07:14
Copy link
Contributor

@zozs zozs left a comment

Choose a reason for hiding this comment

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

Just a few suggestion after checking out the OAuth2 package docs 🙂

internal/login/auth.go Outdated Show resolved Hide resolved
internal/login/auth.go Outdated Show resolved Hide resolved
internal/login/auth.go Outdated Show resolved Hide resolved
internal/login/auth.go Outdated Show resolved Hide resolved
filip-debricked and others added 4 commits September 6, 2024 13:17
Use library functionality (and remove home-brewed alternatives)

Co-authored-by: Linus Karlsson <[email protected]>
@filip-debricked filip-debricked changed the title Initial work on login command (not yet working) Login command Sep 11, 2024
@filip-debricked filip-debricked changed the title Login command Auth command Sep 11, 2024
Copy link
Contributor

@zozs zozs left a comment

Choose a reason for hiding this comment

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

I think this looks excellent now! I hereby declare you an OAuth2 professional :).

Copy link

CodeScene PR Check

Code Health Quality Gates: OK

Change in average Code Health of affected files: +0.07 (9.62 -> 9.69)

  • Declining Code Health: 3 findings(s) 🚩

View detailed results in CodeScene

🚩 Declining Code Health (highest to lowest):

  • Code Duplication auth_test.go
  • Primitive Obsession auth_mock.go
  • String Heavy Function Arguments auth_mock.go

@filip-debricked filip-debricked marked this pull request as ready for review September 19, 2024 08:19
@sweoggy sweoggy merged commit 886b8ad into main Sep 19, 2024
18 checks passed
@sweoggy sweoggy deleted the 0-oauth branch September 19, 2024 08:21
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.

3 participants