Skip to content

Commit

Permalink
Add support for refresh token for softlayer-sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
hkantare committed Aug 12, 2019
1 parent c96fd60 commit 18eb08d
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 7 deletions.
4 changes: 3 additions & 1 deletion ibm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ func (c *Config) ClientSession() (interface{}, error) {
session.bmxUserDetails = userConfig
if sess.SoftLayerSession != nil && sess.SoftLayerSession.IAMToken != "" {
sess.SoftLayerSession.IAMToken = sess.BluemixSession.Config.IAMAccessToken
sess.SoftLayerSession.IAMRefreshToken = sess.BluemixSession.Config.IAMRefreshToken
}

}
Expand Down Expand Up @@ -459,9 +460,10 @@ func newSession(c *Config) (*Session, error) {
RetryWait: c.RetryDelay,
}

if c.IAMToken != "" {
if c.IAMToken != "" && c.IAMRefreshToken != "" {
log.Println("Configuring SoftLayer Session with token")
softlayerSession.IAMToken = c.IAMToken
softlayerSession.IAMRefreshToken = c.IAMRefreshToken
}
if c.SoftLayerAPIKey != "" && c.SoftLayerUserName != "" {
log.Println("Configuring SoftLayer Session with API key")
Expand Down
92 changes: 86 additions & 6 deletions vendor/github.com/softlayer/softlayer-go/session/rest.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions vendor/github.com/softlayer/softlayer-go/session/session.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 18eb08d

Please sign in to comment.