MyJackfruit

Help
Browse topics · For developers

For developers

← For developers

Why must my app's users sign in again on every reload, or after a week?

Short answer

The app does not keep or renew the sign-in: ask for renewal at sign-in, restore it when the app starts, and publish again.

Deeper

Also asked:

Why must my users sign in again after a while? A sign-in token lasts 7 days; without renewal the person then types a new code. With renewal, the sign-in lasts the time you chose, from 5 minutes to 14 days, counted from the last renewal.

Every reload. A sign-in token is tied to a key pair, two matching keys, that your app made. If the app keeps the key only in memory, the key, and with it the sign-in, is gone when the page reloads or closes, and the person types a new code. The sign-in kit gilb-signin 0.3.0 works this way; the answer How do I use the sign-in kit? tells more. To keep the sign-in, the app stores the key, so that it cannot be copied out, with the token and the renewal credential, the hidden secret the app trades for a new token, and restores them when it starts. The signin unit of GilbPlatformCode, GilbPlatform's library of ready-made code, version 0.2.7 or later as the Developer Guide names it, a different package from gilb-signin, does this when the app calls restore() as it starts; it keeps them in the browser's own storage for your app's address.

After a week. A sign-in token lasts 7 days. Without renewal, the person then signs in again with a new code. The app asks for renewal when it trades the code, by sending renew true, or through the signin unit 0.2.7 or later, and then renews before the end. An app built with an older signin does not renew. If the answer to verify-code has no renew field, no renewal started: the page is not on an approved address, renew was not sent, or the account is not active.

Who can renew. Only a web app in a browser, on an address the platform owner approved; an app published at https://<name>.pages.dev with the connector is approved on its own. A site published as a website cannot sign people in. A phone app that sends no web origin gets no renewal.

The fix. Build the app with renewal and restore, and publish it again under the same name; that uses no new site. The answer How do I publish my app from the terminal? shows how. People who signed in before sign in once more; after that they are meant to stay signed in for the time you chose. This has not yet been measured on a published app rebuilt this way. The signin unit is taken from GilbPlatform's code library; the answer How do I reuse app code units? shows how.

Other reasons a person is signed out:
- the time you chose ran out: it counts from the sign-in or the last renewal; the answer How do I choose how long people stay signed in to my app? tells more;
- the person signed out, and your app sent POST https://id.gilb.com/base/auth/sign-out;
- an old renewal credential was sent more than 60 seconds after it was replaced, for example by a second tab or device with an old copy: the platform treats it as a stolen copy and ends that sign-in;
- the person's account is no longer active.

What your app sees. Every refused renewal answers 401 {error:Unauthorized,message:renewal refused}: ask the person for a new code. The causes look the same on purpose. Rarely the answer is 503 {error:ServiceUnavailable,message:the ended sign-in could not be recorded}: send the same renewal once more; it then answers 401, and you ask for a new code.

The Developer Guide, GilbPlatform's guide for people who build apps on it, has the requests and answers in Dev.Guide.SignIn.StaySignedIn, https://appbuilder.gilb.com/base/e/06gwy4emx9ym93q17m0agvadnm (© 2026 Kai Gilb / GilbPlatform, CC BY 4.0); its examples are marked Not yet verified on production. The answer How do I refresh a token? shows the calls.

This answer is written for a computer screen.

Source: GilbPlatform 0fc5a548 (https://id.gilb.com/version, read 13 November 2026): src/auth/email-otc.ts:441, :482 (sign-in token 7 days, capped by the window when a renewal starts); src/routes/email-auth.ts:309-316 (only an exact, approved, not first-party origin starts a renewal; else the answer has no renew fields), :329-346 (no renewal for an account that is not active), :440-460 (renew, renewWindowSec); src/auth/renewable-sign-in.ts:90 (60 seconds), :633-634, :665; src/routes/renew-sign-in.ts:1-12, :26-44 (401 renewal refused for every refusal; 503 the ended sign-in could not be recorded), :125-141 (a reused old credential ends the sign-in and its key); src/routes/sign-out.ts:1-40; src/routes/publish.ts:460-485 (an app's pages.dev origin approved on publish; none for a website). GilbPlatformCode units/signin (package @kaigilb/gilbplatformcode-signin 0.2.9; gilb-signin on npm is another package), https://github.com/KaiGilb/GilbPlatformCode at 2d0b96c1, read 13 November 2026: src/session.ts:15-19 (the key stored as a CryptoKey, never exported; a reload calls restore()), :312-317, :3114 (IndexedDB store by default), :830-833 (restore renews a token inside the guard or expired). Developer Guide (© 2026 Kai Gilb / GilbPlatform, CC BY 4.0), Dev.Guide.SignIn, https://appbuilder.gilb.com/base/e/06gkzpwhanxrh55sca1pdkxj88, read 13 November 2026: exhibits TokenLife (7 days; any other app has no renewal), StaySignedIn (renew true; no renew field for a native app or the platform's own sites; 60 seconds; the 401 and 503 answers and the retry; An app built with the signin unit 0.2.7 or later; Not yet verified on production), KeySafety. Standards read from GilbPlatform on 13 November 2026: Proc_v_i_c_PublishPagesDev (step 2: call restore() when the app starts; step 10: an app built with a signin older than 0.2.7 does not renew: a person stays signed in only until their 7-day token runs out; publish again), Standard Rule_Code_deployment (RuleDeployPagesDev: sign in with the signin unit 0.2.7 or later). Live help pages, sentences shared: How do I use the sign-in kit? (gilb-signin 0.3.0 keeps the key in memory; no renew call); How do I refresh a token?; How long do tokens last?

Checked against GilbApp d529620.