Skip to content
Syno Package Land
Language: English

Standalone login

The login capability adds an app session, from a DSM id cookie for the same host name or a sign-in page that checks account, password and OTP against DSM. No password or OTP code is stored; no administrator setup or Node.js is needed.

It identifies the user but gives no File Station session: see Files.

New project (Vue UI default):

Terminal window
synopkgland init -t native-go --with login my-login

Existing project:

Terminal window
synopkgland add login

Both set this in dsm-package.yaml:

capabilities:
identity: standalone

standalone is the only value. Plain UI (--ui plain, no ui.build) is refused: check reports CAPABILITY_COMBINATION_INVALID and init refuses it. A binary backend reports CAPABILITY_UNSUPPORTED; armv7 is allowed. The generated Vue app shows the sign-in page when there is no session.

  1. DSM cookie. The backend validates a DSM id cookie with DSM’s native authenticate.cgi, keeping the browser’s client address, and exchanges it for an app session over HTTPS. Cookies belong to a host name, not a port, so another port on the same host name receives it; an IP address and a DNS name differ, and a cross-site frame cannot be assumed to receive DSM cookies.
  2. Sign-in page. Without a usable DSM cookie the user enters the DSM account and password; if DSM asks for a second factor, the page asks for the OTP code and resends. The backend signs in to DSM once to prove the identity and ends that DSM session immediately.

Except for app.status and greeting.get, every method rechecks for a live DSM id cookie of the same user; without it the request fails with session_revalidation_required, or dsm_session_required for file and job-import methods, and a cookie for another user ends the session. A password sign-in alone opens only those two methods; anything else needs a DSM sign-in on the same host name.

All are public; each needs a same-origin JSON POST.

MethodParamsResult
identity.status{}{ enabled: true }
identity.session{ bootstrap?: boolean }{ user, uid, expiresAt }; with bootstrap and no app cookie, exchanges the DSM cookie (HTTPS only); forwards X-SYNO-TOKEN from the DSM window on the native check
identity.login{ account, password, otp? }{ user, uid, expiresAt } (HTTPS only)
identity.logout{}{ loggedOut: true }, clears the cookie

createSession(ctx) from @synopackageland/sdk/vue wraps them and returns enabled, ready, subject, notice, start, call, login, bootstrap, logout, dispose. Use session.call(method, params), not ctx.call, for your own methods.

ItemValue
Session15 minutes, extended by each successful DSM-cookie check; at most 4096
Cookiespl_session_<16 hex digits>, HttpOnly, Secure, SameSite=Lax, app path only
Sign-inHTTPS; 5 attempts per account, 20 per client address per minute; DSM answers within 10 seconds
RequestsSame origin (scheme, host, port); account 1024, password 4096, OTP 128 characters

If the user name stops resolving to the same UID, the session ends.

CodeFix
https_requiredPlain HTTP; use HTTPS
invalid_credentialsRetry
account_disabledUse another account
otp_requiredSend the code in otp
login_not_permittedCheck DSM sign-in settings
rate_limitedRetry after a minute
cross_originCall from the app page
origin_requiredReopen in a current browser
session_requiredNo or expired session; sign in again
session_revalidation_requiredSign in to DSM on the same host name, then retry
dsm_session_requiredSame, for nas.*, bg.browse and bg.jobs.submit
auth_unavailableRetry later

See Errors. To keep some users out, use entry as in Native apps.