Skip to content

Commit

Permalink
Merge pull request #12 from int128/browser-delay
Browse files Browse the repository at this point in the history
Add delay before opening browser
  • Loading branch information
int128 authored Aug 31, 2018
2 parents 455c920 + 857d5da commit 309e73d
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 309e73d

Please sign in to comment.