Skip to content

Permissions, OAuth & Token Flows

FynnCloud uses four distinct, least-privilege authentication flows across web iframes, headless protocol servers, app backends, and native companion apps.

1. Web Iframe AppAccessToken (Scoped User JWT)

Section titled “1. Web Iframe AppAccessToken (Scoped User JWT)”

When a user opens your app in the FynnCloud web UI (or invokes a modal/navigate file action), the host mints a short-lived AppAccessToken JWT via POST /api/apps/:appId/token and delivers it to @fynncloud/app-bridge (returning { token, expires_in } — snake_case).

Claim Type Description
sub UUID Acting user ID (or share owner ID for anonymous collaborative shares)
appId string Manifest id of the receiving app
scopes string[] Granted subset of the app’s declared permissions
allowedFileIds UUID[]? Confines files:selected:read / files:selected:write to specific file IDs
allowedFolderIds UUID[]? Confines file creation (destination: "folder" / new_file) to specific folder IDs
allowedTargetApps string[]? Target app IDs authorized by compatibility.apps for cross-app proxy calls
shareLinkID UUID? Present when launched from an anonymous public share link (blocks all user/directory/presence/activity/cross-app endpoints)
grantID UUID? Backing OAuth grant UUID (checked against Redis grant:revoked:{grantID} tombstones)
appPasswordID UUID? Backing App-Specific Password UUID (when exchanged via WebDAV/protocol auth)
exp int Expiration timestamp (refreshed proactively by the host via tokenRefresh event)

When your app container’s backend calls host services directly on FYNNCLOUD_INTERNAL_API_URL (notifications, badges, presence, realtime publish, LiveKit RTC broker, group membership lookup, cross-app proxy), authenticate with:

X-FynnCloud-App-ID: <FYNNCLOUD_APP_ID>
X-FynnCloud-App-Secret: <FYNNCLOUD_APP_SECRET>

FynnCloud compares SHA-256 digests in constant time and verifies that your app is active and declared the required scope in manifest.json:

Backend Endpoint Required Manifest Permission
GET /api/apps/capabilities (none)
POST /api/apps/notifications, /notifications/dismiss, PUT /api/apps/badges notifications:send
GET /api/apps/presence user:read
PUT /api/apps/presence/activity presence:write
POST /api/apps/realtime/publish realtime:push
GET /api/directory/groups/:groupID/members groups:read
GET /api/rtc/status, POST /api/rtc/token, POST /api/rtc/rooms/:room/mute, DELETE /api/rtc/rooms/:room/participants/:identity rtc:rooms
/api/apps/:targetId/proxy/** (with X-FynnCloud-User-ID) compatibility.apps entry for targetId

3. App-Specific Password Verification (Headless Protocol Apps)

Section titled “3. App-Specific Password Verification (Headless Protocol Apps)”

Headless protocol apps such as WebDAV (gateway.public_paths: ["/**"]) accept HTTP Basic Auth (username + fc_app_*) from desktop clients and exchange them for a scoped AppAccessToken via POST /api/auth/app-passwords/verify:

// POST /api/auth/app-passwords/verify
// Headers: X-FynnCloud-App-ID, X-FynnCloud-App-Secret (or in body)
{
"username": "alice",
"password": "fc_app_...",
"app_id": "webdav",
"app_secret": "<FYNNCLOUD_APP_SECRET>"
}

Response (200 OK):

{
"token": "<AppAccessToken JWT>",
"expiresIn": 3600,
"user": { "id": "...", "username": "alice" }
}

4. Native Companion Apps (OAuth 2.0 + PKCE)

Section titled “4. Native Companion Apps (OAuth 2.0 + PKCE)”

Native iOS, macOS, Android, or desktop companion apps (such as FynnCloud Talk for Apple) authenticate through FynnCloud’s built-in OAuth 2.0 Authorization Code + PKCE (S256) flow:

  1. Declare allowed callback URIs under oauth.redirect_uris in manifest.json (e.g. ["fynncloud-talk://auth"]).
  2. Identify your native client as client_id=app:<appId> or client_id=app:<appId>:<variant> (for example app:talk:ios, app:talk:desktop).
  3. Direct the user’s system browser (ASWebAuthenticationSession / Custom Tabs) to /auth/authorize with response_type=code, client_id, redirect_uri, code_challenge, code_challenge_method=S256, and state.
  4. The user signs in (local, Passkey, TOTP, OIDC, or LDAP) and approves the app consent screen.
  5. Exchange the authorization code at POST /api/auth/oauth/token for:
    • Short-lived scoped AppAccessToken (grantID bound)
    • 30-day rotating AppRefreshToken (with a 30-second reuse grace window so flaky mobile networks do not falsely revoke a session when retrying a timed-out refresh)
  6. Call POST /api/auth/logout with the grant-bound AppAccessToken on sign-out to immediately revoke the grant (writing a 60s grant:revoked:{grantID} tombstone in Redis and terminating active SSE streams).

5. Background File Actions (mode: "background")

Section titled “5. Background File Actions (mode: "background")”

When a user triggers a hooks.file_actions entry with "mode": "background" (for example Zipper’s Compress to ZIP), FynnCloud Server does not open an iframe. Instead, it mints a file/folder-confined AppAccessToken and sends an HTTP POST directly to your app’s target route with this JSON body:

{
"token": "<confined AppAccessToken JWT>",
"parentID": "<destination folder UUID when destination:'folder', or current folder UUID>",
"actionId": "compress-zip",
"files": [
{ "id": "<fileUUID>", "name": "report.pdf", "isDirectory": false }
]
}

Permission & Compatibility Upgrade Gate (409 Conflict)

Section titled “Permission & Compatibility Upgrade Gate (409 Conflict)”

When an administrator updates an installed app (PUT /api/apps/:id/update), FynnCloud compares the new manifest.json against the currently approved manifest:

  • If the update adds any new entry to permissions OR adds a new target app / escalates access from "read" to "write" in compatibility.apps, the backend returns 409 Conflict detailing the newly requested capabilities.
  • The Admin UI presents a consent diff modal; the upgrade proceeds only when re-submitted with explicit approval.