From 53685ade9a01fb1bf5501753dbdc9aa0be7f431e Mon Sep 17 00:00:00 2001 From: "hkantare@in.ibm.com" Date: Fri, 27 Sep 2019 11:22:36 +0530 Subject: [PATCH] provide apikey high precednece than tokens --- ibm/config.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ibm/config.go b/ibm/config.go index efc6e18c31..8da1552607 100644 --- a/ibm/config.go +++ b/ibm/config.go @@ -323,7 +323,7 @@ func (c *Config) ClientSession() (interface{}, error) { return session, nil } - if sess.BluemixSession.Config.BluemixAPIKey != "" && (sess.BluemixSession.Config.IAMAccessToken == "" && sess.BluemixSession.Config.IAMRefreshToken == "") { + if sess.BluemixSession.Config.BluemixAPIKey != "" { err = authenticateAPIKey(sess.BluemixSession) if err != nil { session.bmxUserFetchErr = fmt.Errorf("Error occured while fetching account user details: %q", err) @@ -332,7 +332,7 @@ func (c *Config) ClientSession() (interface{}, error) { } } - if sess.BluemixSession.Config.IAMAccessToken != "" { + if sess.BluemixSession.Config.IAMAccessToken != "" && sess.BluemixSession.Config.BluemixAPIKey == "" { err := refreshToken(sess.BluemixSession) if err != nil { return nil, err