@@ -231,29 +231,25 @@ func (s *Session) init(config *configv3.Config, configUaa *configv3.Config, conf
231
231
if tokFromStore .IsSet () {
232
232
accessToken = tokFromStore .AccessToken
233
233
refreshToken = tokFromStore .RefreshToken
234
- goClientConfigOptions = goConfig .Token (accessToken , refreshToken )
235
234
} else if configSess .SSOPasscode != "" {
236
235
// try connecting with SSO passcode to retrieve access token and refresh token
237
236
accessToken , refreshToken , err = uaaClient .Authenticate (map [string ]string {
238
237
"passcode" : configSess .SSOPasscode ,
239
238
}, configSess .Origin , constant .GrantTypePassword )
240
239
errType = "SSO passcode"
241
- goClientConfigOptions = goConfig .Token (accessToken , refreshToken )
242
240
} else if config .CFUsername () != "" {
243
241
// try connecting with pair given on uaa to retrieve access token and refresh token
244
242
accessToken , refreshToken , err = uaaClient .Authenticate (map [string ]string {
245
243
"username" : config .CFUsername (),
246
244
"password" : config .CFPassword (),
247
245
}, configSess .Origin , constant .GrantTypePassword )
248
246
errType = "username/password"
249
- goClientConfigOptions = goConfig .UserPassword (config .CFUsername (), config .CFPassword ())
250
247
} else if config .UAAOAuthClient () != "cf" {
251
248
accessToken , refreshToken , err = uaaClient .Authenticate (map [string ]string {
252
249
"client_id" : config .UAAOAuthClient (),
253
250
"client_secret" : config .UAAOAuthClientSecret (),
254
251
}, configSess .Origin , constant .GrantTypeClientCredentials )
255
252
errType = "client_id/client_secret"
256
- goClientConfigOptions = goConfig .Token (accessToken , refreshToken )
257
253
}
258
254
if err != nil {
259
255
return fmt .Errorf ("Error when authenticate on cf using %s: %s" , errType , err )
@@ -265,6 +261,7 @@ func (s *Session) init(config *configv3.Config, configUaa *configv3.Config, conf
265
261
config .SetAccessToken (fmt .Sprintf ("bearer %s" , accessToken ))
266
262
config .SetRefreshToken (refreshToken )
267
263
264
+ goClientConfigOptions = goConfig .Token (accessToken , refreshToken )
268
265
goconfig , err := goConfig .New (config .ConfigFile .Target , goClientConfigOptions )
269
266
270
267
if err != nil {
0 commit comments