async function checkAccessToken() {
// 1. Get the logged-in user's access token
let cotter = new Cotter("API_KEY_ID"); // π Specify your API KEY ID here
let token = await cotter.tokenHandler.getAccessToken();
var accessToken = token?.token;
access_token: accessToken
// 3. If user is logged in then we fetch the user data
let url = "https://worker.cotter.app/verify";
"Content-Type": "application/json",
API_KEY_ID: "API_KEY_ID" // π Specify your API KEY ID here
body: JSON.stringify(body)
.then((resp) => resp.json())
window.location.href = "/login"; // Redirect to your login page
console.log("Token is valid!");