Skip to main content

Overview

FoN uses three distinct authentication mechanisms, depending on the endpoint you’re calling. Most endpoints rely on a session cookie, a small set of token-management endpoints accept a JWT Bearer token, and uploads via the v1 API accept a long-lived API token.

Authentication Methods

Session Cookies

When you log in (or complete an OAuth flow), the API sets a secure HTTP-only cookie named auth-token containing a JWT, valid for 24 hours. This cookie is automatically sent by browsers with subsequent requests, and is what the vast majority of endpoints check via getCookie(event, 'auth-token').
Session cookies are automatically managed by the browser. For non-browser clients (scripts, curl, etc.), you can authenticate the same way by sending the JWT from the login response as a cookie: Cookie: auth-token=YOUR_JWT_TOKEN.

Log In

Response:
Send the token value from the login response as the auth-token cookie on subsequent requests to session-based endpoints:

JWT Bearer Tokens

The same JWT returned from login can also be passed as a Bearer token, but only for the token-management endpoints (/api/auth/tokens, /api/auth/tokens/generate, and /api/auth/tokens/{id}). These endpoints are how you generate and manage long-lived API tokens.

API Tokens

API tokens are long-lived, raw 64-character hex strings designed for programmatic access. They’re ideal for scripts, bots, and integrations, and are accepted only by /api/v1/upload.

Generate a Token

Response:
Store your API token securely. It’s only displayed once and cannot be retrieved later.

Use the Token

Revoke a Token

OAuth

FoN supports OAuth authentication with:
  • Google
  • Apple
  • Meta (Facebook)
OAuth flows are handled through the web interface. After successful OAuth authentication, a session is established with a JWT token.

Multi-Factor Authentication (MFA)

For enhanced security, enable MFA on your account.

Setup MFA

Response:
1

Scan QR Code

Use an authenticator app (Google Authenticator, Authy, etc.) to scan the QR code
2

Verify Setup

Enter a code from your authenticator to verify setup:
3

Save Backup Codes

Store your 10 backup codes securely. Each can be used once if you lose access to your authenticator.

Login with MFA

When MFA is enabled, include the code in your login request:

Password Management

Change Password

This endpoint authenticates via the auth-token session cookie:

Reset Password

Request a password reset email:
Use the reset token from the email:
Response:
The mfaCode field is only required if MFA is enabled on the account.

Security Best Practices

API tokens are designed for programmatic access and can be revoked individually without affecting your main account.
Multi-factor authentication adds an extra layer of security to your account.
Periodically generate new API tokens and revoke old ones.
Use environment variables or secret management tools to store tokens.