Fix token refresh (#830)

The bug reported via #825 leeds to the conclusion that this could fix the issue.

This needs to be tested with proper credentials, as I don’t have any!
This commit is contained in:
Andreas Linde 2021-03-31 21:48:09 +02:00 • committed by GitHub
parent f793a46007
commit ad1ce28eae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -253,8 +253,7 @@ func (v *Nissan) refreshToken() error {
uri += "?" + data.Encode()
req, err := request.New(http.MethodPost, uri, nil, request.URLEncoding)
if err == nil {
var tokens oidc.Token
if err = v.DoJSON(req, &tokens); err == nil && v.tokens.AccessToken == "" {
if err = v.DoJSON(req, &v.tokens); err == nil && v.tokens.AccessToken == "" {
err = errors.New("missing access token")
}
}