Authentication
Wraps /api/v1/auth/*. Cookie-based sessions plus optional bearer JWT. No admin key required.
The Python AuthClient carries a requests.Session; the cookie planted by login / signup flows through subsequent calls. The TypeScript AuthClient ships an internal cookie shim for Node and uses credentials: "include" in the browser.
Construct
Signup
Creates a user. On 200/201 the server plants the session cookie.
| Param | Type | Required | Notes |
|---|---|---|---|
email | string | yes | Lowercased server-side |
password | string | yes | Server enforces complexity policy |
name | string | no | full_name in Python; name in TS |
Returns the new user object: { id, email, name?, email_verified?, created_at, updated_at, ... }.
Login
When MFA is enrolled, the server returns {"mfaRequired": true} instead of the user. Submit the TOTP code via MFAClient.challenge() to upgrade the partial session.
Logout
204 on success.
Get / delete /me
Password management
request_password_reset always returns success — the server intentionally does not leak whether the email exists.
Email verification
request_email_verification requires an authenticated session. The link's redirect URI is configured server-side (see Email config).
Magic link
Two-call flow: send, then verify.
Server applies per-email rate limiting (1 per 60s) and never reveals account existence.
Permission check
Wraps POST /api/v1/auth/check. Requires a valid session or bearer token.
Self-revoke
Wraps POST /api/v1/auth/revoke. The user kills their own session/JWT.
Error handling
All methods raise SharkAuthError (Python) or SharkAPIError (TypeScript) on non-2xx. Body fields error and message are surfaced in the exception message. See Errors and retries.
Email config
Magic-link, email-verify, password-reset, and invitation links all share a single redirect-URI allowlist configured server-side (dashboard Settings → Email or via shark admin config dump). The SDK forwards your redirect_uri verbatim — the server validates it.
When redirect_uri is omitted, the server's email.default_redirect is used.
See also
- MFA
- Sessions — list/revoke active sessions
- Errors and retries