@@ -12,26 +12,26 @@ import (
1212
1313var (
1414 clientID = kingpin .Flag ("client-id" , "The client ID to be used in getting the access_token." ).Required ().String ()
15- clientSecret = kingpin .Flag ("client-secret" , "The client Secret to be used in the getting the access_token" ).Default ( "" ). String ()
15+ clientSecret = kingpin .Flag ("client-secret" , "The client Secret to be used in the getting the access_token" ).String ()
1616 scopes = kingpin .Flag ("scopes" , "The requested scopes" ).Required ().String ()
1717 customParams = kingpin .Flag ("extra" , "Extra params to be sent along with the client_id during authentication request" ).StringMap ()
1818
1919 authCode = kingpin .Command ("authcode" , "Perform an authorization_code grant flow; https://oauth.net/2/grant-types/authorization-code/" )
2020 authCodeURL = authCode .Arg ("auth_url" , "The URL that will be used for the authorization code generation" ).Required ().String ()
21- tokenURL = authCode .Arg ("token_url" , "The URL to be used in token generation" ).Default ( "" ). String ()
22- authCodeRedirectURLFLag = authCode .Flag ("redirect_url" , "Redirect URL to be passed with the request" ).Default ( "" ). String ()
21+ tokenURL = authCode .Arg ("token_url" , "The URL to be used in token generation" ).String ()
22+ authCodeRedirectURLFLag = authCode .Flag ("redirect_url" , "Redirect URL to be passed with the request" ).String ()
2323
2424 client_credentials = kingpin .Command ("client_credentials" , "Perform client_credential grant flow; https://oauth.net/2/grant-types/client-credentials/" )
2525 clienCredsURL = client_credentials .Arg ("auth_url" , "URL for generating client credential based access token" ).Required ().String ()
2626
2727 implicitGrant = kingpin .Command ("implicit" , "Perform (Legacy) implicit grant type; https://oauth.net/2/grant-types/implicit/" )
2828 implicitURL = implicitGrant .Arg ("auth_url" , "URL for generating implicit access_token" ).Required ().String ()
29- implicitRedirectURLFlag = implicitGrant .Flag ("redirect_url" , "Redirect URL to be passed with the request" ).Default ( "" ). String ()
29+ implicitRedirectURLFlag = implicitGrant .Flag ("redirect_url" , "Redirect URL to be passed with the request" ).String ()
3030
3131 passwordGrant = kingpin .Command ("password" , "Perform (Legacy) password grant type; https://oauth.net/2/grant-types/password/" )
3232 passwordURL = passwordGrant .Arg ("auth_url" , "URL for generatining password flow access_token" ).Required ().String ()
3333 usernameFlag = passwordGrant .Flag ("username" , "Username for authorization" ).Required ().String ()
34- passwordFlag = passwordGrant .Flag ("password" , "User password" ).Default ( "" ). String ()
34+ passwordFlag = passwordGrant .Flag ("password" , "User password" ).String ()
3535)
3636
3737func main () {
@@ -59,8 +59,9 @@ func main() {
5959 token , err := client .GenerateAccessToken (* clientID , clientSecretValue , * scopes , * customParams )
6060 if err != nil {
6161 utils .PrintError (err )
62+ os .Exit (1 )
6263 }
63- fmt .Printf ("token is: %s" , token .AccessToken )
64+ fmt .Printf ("token is: %s\n " , token .AccessToken )
6465}
6566
6667func validateClientSecret (util * utils.MainUtil ) (string , error ) {
0 commit comments