← All packages

@lacspace/auth

v2.1.3Core1 @lacspace dep

Authentication flows (login, register, token, refresh) for Lacspace APIs.

npm i @lacspace/auth

Usage

auth.ts
import { LacspaceAuth } from "@lacspace/auth";

const auth = new LacspaceAuth({ baseURL: "https://api.lacspace.com/api" });

const { token, user } = await auth.login({ email: "you@shop.com", password: "••••••••" });
const me = await auth.me();   // already authenticated
await auth.logout();

Exports 4

LacspaceAuthcreateAuthlocalStorageTokenStoragememoryTokenStorage

Keywords

lacspaceauthauthenticationloginjwttypescript

More in Core