From 318fc27717f4dd8835567e1f775104d19a1c01ab Mon Sep 17 00:00:00 2001 From: alexhokl Date: Sat, 27 Jan 2018 15:32:30 +0800 Subject: [PATCH] Adapted to the change of signature of uuid.NewV4() https://github.com/satori/go.uuid/commit/0ef6afb2f6cdd6cdaeee3885a95099c63f18fc8c --- token.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/token.go b/token.go index 44664bd..ab922cd 100644 --- a/token.go +++ b/token.go @@ -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 @@ -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 {