diff --git a/server/api/oauth/token/index.ts b/server/api/oauth/token/index.ts index d81b2d83..ac7f6e92 100644 --- a/server/api/oauth/token/index.ts +++ b/server/api/oauth/token/index.ts @@ -128,14 +128,18 @@ export default (app: Hono) => access_token: token.accessToken, token_type: "Bearer", expires_in: token.expiresAt - ? (new Date(token.expiresAt).getTime() - - Date.now()) / - 1000 + ? Math.floor( + (new Date(token.expiresAt).getTime() - + Date.now()) / + 1000, + ) : null, id_token: token.idToken, refresh_token: null, scope: token.scope, - created_at: new Date(token.createdAt).toISOString(), + created_at: Math.floor( + new Date(token.createdAt).getTime() / 1000, + ), }); } } diff --git a/tests/oauth.test.ts b/tests/oauth.test.ts index 670db5a2..de5fc402 100644 --- a/tests/oauth.test.ts +++ b/tests/oauth.test.ts @@ -152,7 +152,7 @@ describe("POST /oauth/token/", () => { access_token: expect.any(String), token_type: "Bearer", scope: "read write", - created_at: expect.any(String), + created_at: expect.any(Number), expires_in: expect.any(Number), id_token: null, refresh_token: null,