oauth2: handle token expiry for JWT

Change-Id: I84b4c282ef00e87d13a9b16fdcebd97ea5ed4f4e
Reviewed-on: https://go-review.googlesource.com/1650
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Burcu Dogan
2014-12-16 09:42:17 -08:00
parent 13407478f7
commit 289b5d10a0
2 changed files with 9 additions and 5 deletions

2
jwt.go
View File

@@ -131,7 +131,7 @@ func (js jwtSource) Token() (*Token, error) {
token.AccessToken, _ = b["access_token"].(string)
token.TokenType, _ = b["token_type"].(string)
token.raw = b
if e, ok := b["expires_in"].(int); ok {
if e, ok := b["expires_in"].(float64); ok {
token.Expiry = time.Now().Add(time.Duration(e) * time.Second)
}
if idtoken, ok := b["id_token"].(string); ok {