From 857d5dad884213c0535e3c88574cd5be5803ccac Mon Sep 17 00:00:00 2001 From: Hidetake Iwata Date: Thu, 30 Aug 2018 21:28:17 +0900 Subject: [PATCH] Add delay before opening browser --- auth/authcode.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/auth/authcode.go b/auth/authcode.go index 84e44006..8186bac3 100644 --- a/auth/authcode.go +++ b/auth/authcode.go @@ -5,6 +5,7 @@ import ( "fmt" "log" "net/http" + "time" "github.com/pkg/browser" "golang.org/x/oauth2" @@ -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)) } }()