Merge pull request #2900 from sevki/no-token-err-fix

fix no error returned in fetchTokenWithOAuth
This commit is contained in:
Ryan Abrams 2019-06-19 19:16:18 -07:00 committed by GitHub
commit 84f47e7bb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -366,6 +366,10 @@ func (th *tokenHandler) fetchTokenWithOAuth(realm *url.URL, refreshToken, servic
return "", time.Time{}, fmt.Errorf("unable to decode token response: %s", err) return "", time.Time{}, fmt.Errorf("unable to decode token response: %s", err)
} }
if tr.AccessToken == "" {
return "", time.Time{}, ErrNoToken
}
if tr.RefreshToken != "" && tr.RefreshToken != refreshToken { if tr.RefreshToken != "" && tr.RefreshToken != refreshToken {
th.creds.SetRefreshToken(realm, service, tr.RefreshToken) th.creds.SetRefreshToken(realm, service, tr.RefreshToken)
} }