Skip to content

Commit

Permalink
Add delay before opening browser
Browse files Browse the repository at this point in the history
  • Loading branch information
int128 committed Aug 30, 2018
1 parent 455c920 commit 857d5da
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions auth/authcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"log"
"net/http"
"time"

"github.com/pkg/browser"
"golang.org/x/oauth2"
Expand Down Expand Up @@ -61,6 +62,7 @@ func (f *authCodeFlow) getAuthCode(ctx context.Context) (string, error) {
go func() {
log.Printf("Open http://localhost:%d for authorization", f.ServerPort)
if !f.SkipOpenBrowser {
time.Sleep(500 * time.Millisecond)
browser.OpenURL(fmt.Sprintf("http://localhost:%d/", f.ServerPort))
}
}()
Expand Down

0 comments on commit 857d5da

Please sign in to comment.