-
Notifications
You must be signed in to change notification settings - Fork 0
Add device flow authentication #18
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
Conversation
| if err := listener.Close(); err != nil { | ||
| log.Printf("failed to close listener: %v", err) | ||
| } | ||
| }() |
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.
server.Shutdown() closes the listener, so no explicit close needed
780adc5 to
e39bd29
Compare
| func getWebAppURL() string { | ||
| // allows overriding the URL for testing | ||
| if url := os.Getenv("LOCALSTACK_WEB_APP_URL"); url != "" { | ||
| return url |
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.
Not sure why I added this in the first place, but we never overwrite it at the moment, so I removed it.
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.
Theoretically we could use it to test against staging or locally started webapp.
I wonder though if we should maybe look into handling these envvars with the config package? I'll refactor it slightly later maybe
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.
👍 Makes sense. Put it back in.
I agree it would be good to have a central place to read env vars and not do it all over the codebase.
I used this in the past https://github.com/caarlos0/env
| assert.True(t, inspect.State.Running, "container should be running") | ||
| } | ||
|
|
||
| func TestStartCommandTriggersLoginWithoutToken(t *testing.T) { |
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.
This test was just moved to test/integration/login_browser_flow_test.go
e39bd29 to
6be9ca5
Compare
silv-io
left a comment
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.
Just some minor nits and questions :) But looks nice ✅
| func getWebAppURL() string { | ||
| // allows overriding the URL for testing | ||
| if url := os.Getenv("LOCALSTACK_WEB_APP_URL"); url != "" { | ||
| return url |
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.
Theoretically we could use it to test against staging or locally started webapp.
I wonder though if we should maybe look into handling these envvars with the config package? I'll refactor it slightly later maybe
silv-io
left a comment
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.
LGTM, but looks like the build is failing now :)
This PR adds a device code flow as a fallback option when the browser-based authentication doesn't work.
When running
lstk start, the CLI now supports two authentication paths:User Experience
When running
lstk:If user presses ENTER after confirming in browser:
Mock Server Approach
This PR introduces a platform API client.
The device flow tests use
httptest.NewServerto create a real HTTP server that mimics the platform API.The production code remains unchanged, we just point it to a different URL via
LOCALSTACK_PLATFORM_URL.This allows
TestDeviceFlowSuccessto verify the complete end-to-end flow including container startup with a valid token.