@@ -308,7 +308,6 @@ func NewAPIRequest(r *Request, api string, args []string, isAsync bool) (map[str
308
308
309
309
var encodedParams string
310
310
var err error
311
- usingAPIKeySecretKey := false
312
311
313
312
if len (r .Config .ActiveProfile .APIKey ) > 0 && len (r .Config .ActiveProfile .SecretKey ) > 0 {
314
313
apiKey := r .Config .ActiveProfile .APIKey
@@ -328,7 +327,6 @@ func NewAPIRequest(r *Request, api string, args []string, isAsync bool) (map[str
328
327
encodedParams = encodedParams + fmt .Sprintf ("&signature=%s" , url .QueryEscape (signature ))
329
328
params = nil
330
329
}
331
- usingAPIKeySecretKey = true
332
330
} else if len (r .Config .ActiveProfile .Username ) > 0 && len (r .Config .ActiveProfile .Password ) > 0 {
333
331
sessionKey , err := Login (r )
334
332
if err != nil {
@@ -351,7 +349,11 @@ func NewAPIRequest(r *Request, api string, args []string, isAsync bool) (map[str
351
349
}
352
350
config .Debug ("NewAPIRequest response status code:" , response .StatusCode )
353
351
354
- if response .StatusCode == http .StatusUnauthorized && ! usingAPIKeySecretKey {
352
+ if r .CredentialsSupplied {
353
+ config .Debug ("Credentials supplied on command-line, not falling back to login" )
354
+ }
355
+
356
+ if response .StatusCode == http .StatusUnauthorized && ! r .CredentialsSupplied {
355
357
r .Client ().Jar , _ = cookiejar .New (nil )
356
358
sessionKey , err := Login (r )
357
359
if err != nil {
0 commit comments