Skip to content

User sessions

By default, AlchemyWebSigner user sessions are cached in localStorage for 15 minutes.

You can customize session length by passing a sessionConfig to your AlchemyWebSigner constructor.

You can check if the user has an active session with the following command:

getAuthDetails.ts
import { signer } from "./signer";
 
// NOTE: this method throws if there is no authenticated user
// so we return null in the case of an error
const user = await signer.getAuthDetails().catch(() => null);

If there is an existing session, then your signer is ready for use! If not, see the section above for logging users in.