Refresh access tokens
Import the function at the top of your file
import { refreshTokens } from "swizzle-js";Use a refresh token to get a new access token refreshTokens(refeshToken, hours?).
Optional: Pass the number of hours the new access token should expire after.
Returns an object with accessToken and refreshToken. accessToken should be passed in the header Authorization: Bearer<accessToken>.
const tokens = await refreshTokens(request.body.refreshToken)
const accessToken = tokens.accessToken
const refreshToken = tokens.refreshTokenLast updated