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.
Add it
Section titled “Add it”New project (Vue UI default):
synopkgland init -t native-go --with login my-loginExisting project:
synopkgland add loginBoth set this in dsm-package.yaml:
capabilities: identity: standalonestandalone 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.
How a user gets in
Section titled “How a user gets in”- DSM cookie. The backend validates a DSM
idcookie with DSM’s nativeauthenticate.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. - 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.
What an app session allows
Section titled “What an app session allows”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.
| Method | Params | Result |
|---|---|---|
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.
Limits
Section titled “Limits”| Item | Value |
|---|---|
| Session | 15 minutes, extended by each successful DSM-cookie check; at most 4096 |
| Cookie | spl_session_<16 hex digits>, HttpOnly, Secure, SameSite=Lax, app path only |
| Sign-in | HTTPS; 5 attempts per account, 20 per client address per minute; DSM answers within 10 seconds |
| Requests | Same origin (scheme, host, port); account 1024, password 4096, OTP 128 characters |
If the user name stops resolving to the same UID, the session ends.
Troubleshooting
Section titled “Troubleshooting”| Code | Fix |
|---|---|
https_required | Plain HTTP; use HTTPS |
invalid_credentials | Retry |
account_disabled | Use another account |
otp_required | Send the code in otp |
login_not_permitted | Check DSM sign-in settings |
rate_limited | Retry after a minute |
cross_origin | Call from the app page |
origin_required | Reopen in a current browser |
session_required | No or expired session; sign in again |
session_revalidation_required | Sign in to DSM on the same host name, then retry |
dsm_session_required | Same, for nas.*, bg.browse and bg.jobs.submit |
auth_unavailable | Retry later |
See Errors. To keep some users out, use entry as in Native apps.