API ReferenceType Aliases
Credentials
Type Alias: Credentials
type Credentials = {
email?: string;
password: string;
phone?: string;
username?: string;
};Defined in: types.ts:46
Login credentials passed to SnapcapClient's constructor.
Snap's WebLogin proto identifies an account by exactly one of username,
email, or phone. Pass that single identifier together with password.
Remarks
Phone numbers should be in E.164 format (e.g. +14155552671).
Optional on SnapcapClientOpts — warm-start scenarios where cookies are
already in the DataStore can omit credentials entirely and rely on
cookie-based bearer mint. Required if cold-login is needed.
Use activeIdentifier to extract the identifier-type pair from a
Credentials value at runtime.
Examples
Username + password (most common):
const creds: Credentials = { username: "alice", password: "..." };Email or phone instead of username:
const byEmail: Credentials = { email: "alice@example.com", password: "..." };
const byPhone: Credentials = { phone: "+14155552671", password: "..." };See
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
email? | string | Email address registered to the account. Pass exactly one identifier. | types.ts:50 |
password | string | Account password. Always required. | types.ts:54 |
phone? | string | Phone number in E.164 format (e.g. +14155552671). Pass exactly one identifier. | types.ts:52 |
username? | string | Snap username. Pass exactly one of username, email, or phone. | types.ts:48 |