Skip to content

Commit

Permalink
Merge pull request #2 from alexhokl/uuid-newv4
Browse files Browse the repository at this point in the history
Adapted to the change of signature of uuid.NewV4()
  • Loading branch information
LyricTian authored Jan 27, 2018
2 parents e44a7c9 + 318fc27 commit 552c26c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions token.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ func (rs *TokenStore) Create(info oauth2.TokenInfo) (err error) {
if code := info.GetCode(); code != "" {
pipe.Set(code, jv, info.GetCodeExpiresIn())
} else {
basicID := uuid.NewV4().String()
basicID, uerr := uuid.NewV4()
if uerr != nil {
err = uerr
return
}
basicIDStr := basicID.String()
aexp := info.GetAccessExpiresIn()
rexp := aexp

Expand All @@ -59,10 +64,10 @@ func (rs *TokenStore) Create(info oauth2.TokenInfo) (err error) {
if aexp.Seconds() > rexp.Seconds() {
aexp = rexp
}
pipe.Set(refresh, basicID, rexp)
pipe.Set(refresh, basicIDStr, rexp)
}
pipe.Set(info.GetAccess(), basicID, aexp)
pipe.Set(basicID, jv, rexp)
pipe.Set(info.GetAccess(), basicIDStr, aexp)
pipe.Set(basicIDStr, jv, rexp)
}

if _, verr := pipe.Exec(); verr != nil {
Expand Down

0 comments on commit 552c26c

Please sign in to comment.