From: Florian Forster Date: Mon, 22 Jan 2018 08:01:19 +0000 (+0100) Subject: Package app: Check all fields of the OAuth token for equality. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=1e56486bef9e08de7d1f17d2c466710c3d79e8f1;p=kraftakt.git Package app: Check all fields of the OAuth token for equality. It appears that refresh tokens don't always change. Check the AccessToken field, too, and the rest of the struct for completeness sake. --- diff --git a/app/user.go b/app/user.go index 1215653..d5b8452 100644 --- a/app/user.go +++ b/app/user.go @@ -121,7 +121,10 @@ func (s *persistingTokenSource) Token() (*oauth2.Token, error) { 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) }