Skip to content

Commit

Permalink
set grant type to correct refresh token
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurHlt committed Aug 11, 2021
1 parent 03d8000 commit b41fe54
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,13 @@ func (s *Session) init(config *configv3.Config, configUaa *configv3.Config, conf
"username": config.CFUsername(),
"password": config.CFPassword(),
}, "", constant.GrantTypePassword)
config.SetUAAGrantType(string(constant.GrantTypePassword))
} else if config.UAAOAuthClient() != "cf" {
accessToken, refreshToken, err = uaaClient.Authenticate(map[string]string{
"client_id": config.UAAOAuthClient(),
"client_secret": config.UAAOAuthClientSecret(),
}, "", constant.GrantTypeClientCredentials)
config.SetUAAGrantType(string(constant.GrantTypeClientCredentials))
}
if err != nil {
return fmt.Errorf("Error when authenticate on cf: %s", err)
Expand Down Expand Up @@ -261,11 +263,13 @@ func (s *Session) init(config *configv3.Config, configUaa *configv3.Config, conf
"username": config.CFUsername(),
"password": config.CFPassword(),
}, "", constant.GrantTypePassword)
configUaa.SetUAAGrantType(string(constant.GrantTypePassword))
} else {
accessTokenSess, refreshTokenSess, err = uaaClientSess.Authenticate(map[string]string{
"client_id": configUaa.UAAOAuthClient(),
"client_secret": configUaa.UAAOAuthClientSecret(),
}, "", constant.GrantTypeClientCredentials)
configUaa.SetUAAGrantType(string(constant.GrantTypeClientCredentials))
}

if err != nil {
Expand Down

0 comments on commit b41fe54

Please sign in to comment.