get-utc-time.ts11 lines · main
1import { 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.
5const handler = async (_req: NextApiRequest, res: NextApiResponse) => {
6 const utcTime = new Date().toISOString()
7
8 return res.status(200).json({ utcTime })
9}
10
11export default handler