Skip to content

Interface: AccountClientOptions ​

Defined in: client/accounts.ts:9

Where the accounts API is and how the session travels. Every option has a default.

Properties ​

PropertyTypeDescriptionDefined in
baseUrl?stringWhere the Worker is, e.g. "https://game.example.com". Defaults to the page's own origin.client/accounts.ts:11
prefix?stringWhere the accounts API is served. Default "/api/accounts".client/accounts.ts:13
mode?"cookie" | "bearer"How the session travels. "cookie" (the default in browsers): an HttpOnly cookie the page's scripts never see. "bearer" (the default elsewhere): the client keeps the session token and sends it with every request; pass session to restore one and onSession to keep it.client/accounts.ts:20
session?string | nullA session token to start with, in bearer mode.client/accounts.ts:22
storage?KeyValueStore | nullWhere to keep the guest identity between visits. Defaults to localStorage when there is one.client/accounts.ts:26
fetch?(input, init?) => Promise<Response>The fetch to use. Defaults to the global one.client/accounts.ts:28

Methods ​

onSession()? ​

ts
onSession?(token): void;

Defined in: client/accounts.ts:24

Called when the session token changes, in bearer mode: store it to stay signed in.

Parameters ​

ParameterType
tokenstring | null

Returns ​

void

MIT licence. Tickflare is an independent project and is not affiliated with Cloudflare.