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

Add browser-based authentication abstraction #216

Merged
merged 4 commits into from
Feb 28, 2024

Conversation

calebstewart
Copy link
Contributor

spacectl currently exports the profile and credential management packages, which has been helpful when developing an external tool to interact with the Spacelift GraphQL API. I could use spacectl to authenticate, and then have my tool interoperate with the spacectl stored credentials. However, I'd like to allow my tool to trigger authentication if a token expires. The code for this is relatively simple, but undocumented (as far as I could tell) by Spacelift.

This PR pulls the browser authentication routine out of internal/cmd/profile/login_command.go and into a separate package which can be used externally to trigger the authentication flow. It does not depend on any specific logging or browser packages, and instead provides a programmatic interface to initiate the authentication flow, and handle the callback while allowing the package user to handle errors, logging, output, etc.

I'm not sure what the appetite for this is like upstream, however I already wrote the code for my personal use, and thought it might be helpful upstream.

@tomasmik tomasmik requested review from tomasmik and a team January 29, 2024 08:01
@tomasmik tomasmik merged commit 94ba6a0 into spacelift-io:main Feb 28, 2024
8 checks passed
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.

None yet

2 participants