It appears that refresh tokens don't always change. Check the AccessToken
field, too, and the rest of the struct for completeness sake.
return nil, err
}
- if s.t.RefreshToken != tok.RefreshToken {
+ if s.t.AccessToken != tok.AccessToken ||
+ s.t.TokenType != tok.TokenType ||
+ s.t.RefreshToken != tok.RefreshToken ||
+ !s.t.Expiry.Equal(tok.Expiry) {
if _, err := datastore.Put(s.ctx, s.key, tok); err != nil {
log.Errorf(s.ctx, "persisting OAuth token in datastore failed: %v", err)
}