Sign in with the Shiloh account
Staff can sign in to the Tienda back office with their Shiloh account, through OpenID Connect. The e-mailed code keeps working next to it. The feature is off until an operator configures it. With it off, the sign-in page and the API behave as before, and the OpenID Connect endpoints answer 404.
Not verified
This feature has automated tests but has not yet been in daily use; treat it as new.
What it does for a user
- The sign-in page shows a button for the Shiloh account first and the e-mailed
code as the second choice. It shows the button only when the operator has
configured the feature (
GET /api/v1/auth/configtells the page). - The first time, the provider's identity is linked to the Tienda user whose e-mail address is the same. After that the link is by the provider's own stable identifier, so a changed e-mail address at the provider never moves an account.
- Nobody is created by signing in. A Shiloh account that matches no Tienda user sees "No shop is linked to this Shiloh account yet". A Tienda user with no shop sees "No shop yet".
- A person who belongs to several shops chooses one after signing in. The chooser shows a card per shop with the shop's own logo, or its initials on the shop's colour, and marks the last used shop. It can be worked from the keyboard: the last used shop has focus, Enter opens it, and the arrow keys move between the cards. The footer names the signed-in person and shows the version. A suspended shop is shown but cannot be opened.
Rules for the first link:
- Only an address the provider says is verified is used.
- A user already linked to a different Shiloh account is never taken over.
- Platform operators, accounts whose only role is driver, and an address that more than one Tienda user holds are not linked automatically. They see "ask your administrator".
Sessions and logout
Tienda keeps its own session token. After signing in at the provider, the browser is sent back to the back office with a single-use ticket that is valid for two minutes and only works in the browser that started the sign-in. The back office exchanges it for the session token; the token itself never appears in an address.
When a Shiloh session ends, the provider tells Tienda through back-channel logout, and Tienda ends the sessions that were started from it. A notice without a session id ends all sessions of that person, including those started with an e-mailed code. Sessions started with an e-mailed code are otherwise not touched.
Operator settings
An operator turns it on by setting these variables on the API service. The names are listed in Configuration.
| Name | Required | Meaning |
|---|---|---|
TIENDA_OIDC_ISSUER | yes | The provider's issuer address. Must be https, except for a provider on localhost in development. |
TIENDA_OIDC_CLIENT_ID | yes | The client id of the Tienda provider. |
TIENDA_OIDC_CLIENT_SECRET | yes | Its client secret. Only the API holds it. |
TIENDA_OIDC_APP_URL | yes | The back office address the browser returns to. |
TIENDA_OIDC_REDIRECT_URI | no | The callback address, if it differs from the API's own. |
TIENDA_OIDC_ALLOWED_HOSTS | no | Extra hosts the provider's endpoints may be on. Default: the issuer's host only. |
TIENDA_OIDC_SCOPES | no | Default openid email profile. |
The provider side needs: a confidential client with the authorization code flow
(PKCE is always used), a signing key of an asymmetric kind (tokens signed with
none or HMAC are refused), an ID token with email, email_verified and a
stable sub, and back-channel logout pointing at the API.
The same provider also signs in AI clients on the MCP consent screen (see MCP overview). It reuses this client and its callback, so no second provider client is needed.
Tienda reads email_verified strictly: only the JSON boolean true counts. A
provider that sends false for every address, or lets users change their e-mail
without verifying it again, must be fixed before the feature is switched on.
To turn it off, unset any one of the required variables and restart the API. Users stay linked and sessions already issued keep working until they expire.