Skip to content

Commit

Permalink
Makes sure that the JWT iat is an integer
Browse files Browse the repository at this point in the history
  • Loading branch information
mwoodffdc committed Mar 11, 2019
1 parent cdae5b4 commit f83ca64
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/index/client/oauth2Jwt/jwt.ts
Expand Up @@ -80,16 +80,13 @@ export async function createJwtBearerGrantAssertion(env: Environment, params: Jw
*/
function createPayload(aud: string, iss: string, sub: string): JWT {

const now = Date.now() / 1000;

const nowPlusFourMinutes = () => {
return Math.floor(Date.now() / 1000) + (60 * 4);
};
const iat = Math.floor(Date.now() / 1000);
const exp = iat + (60 * 4);

return {
aud,
exp: nowPlusFourMinutes(),
iat: now,
exp,
iat,
iss,
jti: uuid().toString(),
sub
Expand Down

0 comments on commit f83ca64

Please sign in to comment.