get-utc-time.ts11 lines · main
| 1 | import { NextApiRequest, NextApiResponse } from 'next' |
| 2 | |
| 3 | // Returns the current UTC time in ISO format. Used to check if the client and server time are skewed. Clock skew causes |
| 4 | // issues with JWT verification. |
| 5 | const handler = async (_req: NextApiRequest, res: NextApiResponse) => { |
| 6 | const utcTime = new Date().toISOString() |
| 7 | |
| 8 | return res.status(200).json({ utcTime }) |
| 9 | } |
| 10 | |
| 11 | export default handler |