server: use seconds instead of nano seconds for expires_in and expiry

This commit is contained in:
Eric Chiang
2016-11-03 21:39:31 -07:00
parent ce703a7fe1
commit 12a5c0ada3
2 changed files with 39 additions and 2 deletions

View File

@@ -439,7 +439,7 @@ func (s *Server) sendCodeResponse(w http.ResponseWriter, r *http.Request, authRe
v.Set("token_type", "bearer")
v.Set("id_token", idToken)
v.Set("state", authReq.State)
v.Set("expires_in", strconv.Itoa(int(expiry.Sub(s.now()))))
v.Set("expires_in", strconv.Itoa(int(expiry.Sub(s.now()).Seconds())))
u.Fragment = v.Encode()
}
}
@@ -637,7 +637,7 @@ func (s *Server) writeAccessToken(w http.ResponseWriter, idToken, refreshToken s
}{
storage.NewID(),
"bearer",
int(expiry.Sub(s.now())),
int(expiry.Sub(s.now()).Seconds()),
refreshToken,
idToken,
}