Skip to content
This repository has been archived by the owner on May 16, 2021. It is now read-only.

Commit

Permalink
refactor: rename method for localhost
Browse files Browse the repository at this point in the history
  • Loading branch information
mainawycliffe committed Dec 5, 2019
1 parent 7d055a4 commit 23ae013
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 1 addition & 3 deletions cmd/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
Run: func(cmd *cobra.Command, args []string) {

oauth.StartLocalhostServer()

oauth.LoginWithLocalhost()
},
}

Expand Down
5 changes: 5 additions & 0 deletions oauth/oauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ func StartLocalhostServer() {
Scopes: scopes,
Endpoint: google.Endpoint,
}
}

// LoginWithLocalhost starts a server that can be used to capture OAUTH
// token from Google Auth Server
func LoginWithLocalhost() {
oauthStateTracker := generateOauthStateTracker()
u := googleOauthConfig.AuthCodeURL(oauthStateTracker)
fmt.Printf("Visit this URL on any device to log in:\n\n%s\n\nWaiting for authentication...", u)
Expand Down

0 comments on commit 23ae013

Please sign in to comment.