Add check for token without expiration date
This commit is contained in:
parent
4feba517aa
commit
9c99b27547
|
@ -1,6 +1,4 @@
|
||||||
import { randomBytes } from "crypto";
|
|
||||||
import type { APIRoute } from "astro";
|
import type { APIRoute } from "astro";
|
||||||
import type AccessToken from "../../../types/AccessToken";
|
|
||||||
import { getAccessToken } from "../../../lib/accessTokens";
|
import { getAccessToken } from "../../../lib/accessTokens";
|
||||||
|
|
||||||
export const GET: APIRoute = async({ request }) => {
|
export const GET: APIRoute = async({ request }) => {
|
||||||
|
@ -23,7 +21,7 @@ export const GET: APIRoute = async({ request }) => {
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
if(response.expiresAt.getTime() < Date.now()) return new Response(
|
if(response.expiresAt !== null && response.expiresAt.getTime() < Date.now()) return new Response(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
code: 403,
|
code: 403,
|
||||||
message: "Forbidden",
|
message: "Forbidden",
|
||||||
|
|
Loading…
Reference in New Issue