authhandler: Update default_authhandler.go to inline handler logic

This commit is contained in:
Andy Zhao 2021-03-11 21:36:49 -08:00
parent cde11fb840
commit 7c289229ae
1 changed files with 5 additions and 9 deletions

View File

@ -29,14 +29,10 @@ import (
// option.WithTokenSource(tokenSource)) // option.WithTokenSource(tokenSource))
func DefaultAuthorizationHandler(state string) AuthorizationHandler { func DefaultAuthorizationHandler(state string) AuthorizationHandler {
return func(authCodeURL string) (string, string, error) { return func(authCodeURL string) (string, string, error) {
return defaultAuthorizationHandlerHelper(state, authCodeURL)
}
}
func defaultAuthorizationHandlerHelper(state string, authCodeURL string) (string, string, error) {
fmt.Printf("Go to the following link in your browser:\n\n %s\n\n", authCodeURL) fmt.Printf("Go to the following link in your browser:\n\n %s\n\n", authCodeURL)
fmt.Println("Enter authorization code: ") fmt.Println("Enter authorization code: ")
var code string var code string
fmt.Scanln(&code) fmt.Scanln(&code)
return code, state, nil return code, state, nil
}
} }