Cookie Authorization


You can save only cookies for ~30 days

import { AuthInstance } from "@valapi/auth";
const instance = new AuthInstance({ cookie: serializeCookie });

const auth = new Auth({ user: instance.toJSON() });

I recommend running this every time you deserialize

// new Date() >= auth.expirationDate

if (!auth.isAuthenticated) {
    await auth.reauthorize();
}

ref.