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 support for autoclosing oauth flow window #1618
Conversation
Code looks good, but I haven't tested it. |
86a8f4a
to
16e4221
Compare
@wlynch @imjasonh pinging you here too, @bobcallaway was wondering if you had tried this out and run into an issue |
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.
I tried to get it working awhile back and had trouble, but my javascript is also very weak. (@stgarf If you happened know why my last attempt to get this to work wasn't successful, I'd love to learn why! 🙏 )
@stgarf made a similar change in chainctl
and we confirmed it works, so I'm all for this! 🚀
@wlynch to answer your question for posterity |
Introduce the ability to automatically close the browser window after a successful OAuth authentication flow in Sigstore. The HTML returned by `GetInteractiveSuccessHTML` varies based on the autoclose flag and a specified timeout. This change improves the ux by eliminating the need to close the page manually after successful authentication. Resolves: #1617 Signed-off-by: Steve Garf <garf@chainguard.dev>
7191539
to
28eb779
Compare
Thanks folks! Commits have been squashed. |
Summary
This solves a small UX friction point. It can be tested by using something that makes use of the interactive flow like
gitsign
and I've integrated those changes here to test with.Update
go.mod
to contain:replace github.com/sigstore/sigstore => github.com/stgarf/sigstore 510ce9e
and then run
go mod tidy
. You should be able to test out the changes. Of note is that the page will not close automatically if no connectorid (for gitsign for example) is set due to the fact that the window.close API call will only succeed if the page is the first item in the window's history.Release Note
Updated the
interactiveIDTokenSource
struct to haveautoclose
andautocloseTimeout
fields which default tofalse
and0
respectively. The originalInteractiveSuccessHTML
returned inflow.go
has been changed from a static string to a dynamic go template which can be returned with a call toGetInteractiveSuccessHTML(autoclose bool, timeout int)
.Documentation
This may require an update to docs but I am not sure where. I've only seen
gitsign
using this so far and I've already made some documentation updates in my fork of it.