get-utc-time.ts 395 B

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