mirror of
https://github.com/versia-pub/server.git
synced 2025-12-07 08:48:19 +01:00
fix(api): 🐛 Fix oauth token endpoint returning an ISO-8601 string instead of a unix timestamp
This commit is contained in:
parent
ff14e5a5d3
commit
9566387273
|
|
@ -128,14 +128,18 @@ export default (app: Hono) =>
|
||||||
access_token: token.accessToken,
|
access_token: token.accessToken,
|
||||||
token_type: "Bearer",
|
token_type: "Bearer",
|
||||||
expires_in: token.expiresAt
|
expires_in: token.expiresAt
|
||||||
? (new Date(token.expiresAt).getTime() -
|
? Math.floor(
|
||||||
|
(new Date(token.expiresAt).getTime() -
|
||||||
Date.now()) /
|
Date.now()) /
|
||||||
1000
|
1000,
|
||||||
|
)
|
||||||
: null,
|
: null,
|
||||||
id_token: token.idToken,
|
id_token: token.idToken,
|
||||||
refresh_token: null,
|
refresh_token: null,
|
||||||
scope: token.scope,
|
scope: token.scope,
|
||||||
created_at: new Date(token.createdAt).toISOString(),
|
created_at: Math.floor(
|
||||||
|
new Date(token.createdAt).getTime() / 1000,
|
||||||
|
),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,7 @@ describe("POST /oauth/token/", () => {
|
||||||
access_token: expect.any(String),
|
access_token: expect.any(String),
|
||||||
token_type: "Bearer",
|
token_type: "Bearer",
|
||||||
scope: "read write",
|
scope: "read write",
|
||||||
created_at: expect.any(String),
|
created_at: expect.any(Number),
|
||||||
expires_in: expect.any(Number),
|
expires_in: expect.any(Number),
|
||||||
id_token: null,
|
id_token: null,
|
||||||
refresh_token: null,
|
refresh_token: null,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue