<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[offline access&#x2F;authentication]]></title><description><![CDATA[<p dir="auto">I'm building a mobile app that needs to work in places with spotty or no connectivity (think field workers, transit, rural areas).</p>
<p dir="auto">Can I use FusionAuth as my central identity provider while still letting users authenticate when the device is offline?</p>
]]></description><link>https://fusionauth.io/community/forum/topic/3129/offline-access-authentication</link><generator>RSS for Node</generator><lastBuildDate>Thu, 07 May 2026 17:09:54 GMT</lastBuildDate><atom:link href="https://fusionauth.io/community/forum/topic/3129.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 07 May 2026 14:48:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to offline access&#x2F;authentication on Thu, 07 May 2026 14:58:40 GMT]]></title><description><![CDATA[<p dir="auto">The cleanest way to do it is with asymmetric JWT verification plus a bounded offline grace period.** Here's the pattern.</p>
<p dir="auto">FusionAuth signs JWTs with a private key it holds. The matching public key is published at the JWKS endpoint (<code>/.well-known/jwks.json</code>). Your mobile app — or any resource server — can verify a token's signature <em>locally</em>, with zero network calls, as long as it has that public key. You can even bundle the public key with the application and avoid the retrieving it.</p>
<p dir="auto">That's the property that makes offline auth possible. You're not asking "is this token still good?" over the wire; you're asking "did FusionAuth sign this, and has it expired?" using math the device can do on its own.</p>
<p dir="auto">See <a href="https://fusionauth.io/docs/lifecycle/authenticate-users/login-api/json-web-tokens#configuring-jwt-signing" rel="nofollow ugc">JWT signing configuration</a> and the <a href="https://fusionauth.io/docs/lifecycle/authenticate-users/oauth/endpoints#json-web-key-set-jwks" rel="nofollow ugc">JWKS endpoint docs</a>.</p>
<p dir="auto"><strong>The Flow</strong></p>
<p dir="auto"><strong>1. First login (online, required).</strong> The user authenticates against FusionAuth via OAuth with the <code>offline_access</code> scope, or via the Login API with <code>loginId</code> + <code>password</code> + <code>applicationId</code>. You get back two things:</p>
<ul>
<li>A short-lived <strong>access token</strong> (signed JWT, RS256, EdDSA, or ES256)</li>
<li>A long-lived <strong>refresh token</strong> (opaque, default 30 days, configurable per tenant or application)</li>
</ul>
<p dir="auto">Refresh token details are in the <a href="https://fusionauth.io/docs/lifecycle/authenticate-users/login-api/json-web-tokens#refresh-token-settings" rel="nofollow ugc">refresh token settings docs</a>.</p>
<p dir="auto"><strong>2. Cache the JWKS on the device.</strong> Fetch <code>/.well-known/jwks.json</code> once and store it. You'll match incoming tokens to the right key using the <code>kid</code> in the JWT header. For fully air-gapped scenarios, you can bundle the JWKS into the app at build time — see <a href="https://fusionauth.io/blog/air-gapping#using-air-gapped-fusionauth" rel="nofollow ugc">the air-gapping article</a>.</p>
<p dir="auto"><strong>3. Online operation.</strong> The app uses the access token for API calls. When it expires, the app calls the <a href="https://fusionauth.io/docs/apis/jwt#refresh-a-jwt" rel="nofollow ugc">Refresh a JWT API</a> with the refresh token to mint a new access token.</p>
<p dir="auto"><strong>4. Offline operation.</strong> The app validates the cached access token locally:</p>
<ul>
<li>Find the key in the JWKS where <code>kid</code> matches the JWT header</li>
<li>Verify the signature with that public key</li>
<li>Check <code>exp</code>, <code>iss</code>, <code>aud</code>, and any custom claims you care about</li>
</ul>
<p dir="auto">If the token is past <code>exp</code> but the device is offline, allow a bounded grace period (e.g., 24 hours past expiration). After that, degrade functionality until the device reconnects and refreshes. For instance, you could allow read operations but nothing that changes data.</p>
<p dir="auto"><strong>5. On reconnect.</strong> Refresh immediately. If the refresh token has been revoked server-side, the call will fail and the user must re-authenticate.</p>
<p dir="auto"><strong>Token lifetime tuning</strong></p>
<p dir="auto">This is where you make your security/availability tradeoff explicit. FusionAuth lets you tune both lifetimes per tenant or per application:</p>
<ul>
<li><strong>Access token TTL</strong> (<code>ttl_seconds</code><img src="https://fusionauth.io/community/forum/assets/plugins/nodebb-plugin-emoji/emoji/android/1f61e.png?v=rcgg4tg866g" class="not-responsive emoji emoji-android emoji--disappointed" style="height:23px;width:auto;vertical-align:middle" title="):" alt="😞" /> set this short for online use (5–15 minutes is typical), but if you want longer offline windows without the grace-period workaround, you can extend it. Whatever you pick is the maximum revocation lag for compromised tokens.</li>
<li><strong>Refresh token duration</strong>: default is ~30 days. Use a <strong>Sliding Window with Maximum Lifetime</strong> policy if you want active devices to keep working but inactive ones to expire automatically.</li>
<li><strong>One-Time Use refresh tokens</strong>: rotates the token value on every refresh. Strongly recommended — if a refresh token is stolen and used, the legitimate device's next refresh will fail and the theft is detected.</li>
</ul>
<p dir="auto"><strong>What FusionAuth gives you for revocation</strong></p>
<p dir="auto">Refresh tokens can be revoked automatically on password change, MFA enrollment, or any action that prevents login. You can also call the <a href="https://fusionauth.io/docs/apis/jwt#revoke-refresh-tokens" rel="nofollow ugc">Revoke Refresh Tokens API</a> directly. The catch: revocation only takes effect the next time the device tries to refresh. Already-issued access tokens remain valid until their <code>exp</code>.</p>
<p dir="auto"><strong>Tradeoffs you're signing up for</strong></p>
<p dir="auto">Be honest with yourself about this approach. These aren't FusionAuth limitations, they're inherent to offline auth:</p>
<ul>
<li><strong>Delayed revocation.</strong> A stolen device retains access until the access token expires <em>and</em> the offline grace period elapses. Shorter access token TTLs mean faster revocation but more refresh traffic and shorter offline windows. Pick where on that curve you want to sit.</li>
<li><strong>Clock trust.</strong> Offline <code>exp</code> checks rely on the device clock, which the user controls. If that matters for your threat model, store a "last known server time" on each refresh and refuse to validate tokens if the clock has moved backward.</li>
<li><strong>Stale claims.</strong> If a user's roles or permissions change, the old claims persist in the cached token until the next refresh. Acceptable for most apps, not for high-stakes authorization.</li>
<li><strong>Local credential storage.</strong> If you want users to "log in" while offline (PIN/biometric to unlock the cached session), you're storing something derivable from their credential on the device. Use the platform secure storage (iOS Keychain, Android Keystore) and a slow KDF like Argon2id for any password-derived material.</li>
<li><strong>Key rotation.</strong> If you bundle JWKS into the app, you have to ship app updates ahead of key rotations (or plan to create a bunch of keys ahead of time). If you fetch JWKS dynamically, you need a cache strategy and a fallback when the cache is stale and the network is down.</li>
<li><strong>MFA degrades offline.</strong> Push and SMS-based factors require connectivity. Offline auth typically falls back to device-bound factors (the refresh token + a local PIN/biometric), which is different than your online MFA flow. Decide whether that's acceptable.</li>
</ul>
<p dir="auto"><strong>Practical starting point</strong></p>
<p dir="auto">Here's an example of the configuration:</p>
<ul>
<li>Access token TTL: <strong>15 minutes</strong></li>
<li>Refresh token: <strong>30 days, sliding window, one-time use</strong></li>
<li>Offline grace period (app-enforced): <strong>24 hours past <code>exp</code></strong></li>
<li>JWKS: fetched on first launch, refreshed weekly when online, with a bundled fallback</li>
<li>Mandatory online check-in: <strong>every 7 days</strong> (refuse to operate offline beyond this)</li>
</ul>
<p dir="auto">Tighten the numbers for higher-sensitivity apps, loosen them for field-work apps where availability matters more than instant revocation.</p>
<p dir="auto">Some further reading for you:</p>
<ul>
<li><a href="https://fusionauth.io/articles/tokens/building-a-secure-jwt" rel="nofollow ugc">Building a Secure JWT</a></li>
<li><a href="https://fusionauth.io/articles/tokens/revoking-jwts" rel="nofollow ugc">Revoking JWTs</a></li>
<li><a href="https://fusionauth.io/docs/operate/secure/token-storage" rel="nofollow ugc">Token storage best practices</a></li>
<li><a href="https://fusionauth.io/blog/air-gapping" rel="nofollow ugc">Air-gapping FusionAuth</a></li>
</ul>
<p dir="auto">The short version: FusionAuth gives you all the primitives:</p>
<ul>
<li>asymmetric signing</li>
<li>JWKS</li>
<li>configurable lifetimes</li>
<li>refresh token revocation</li>
</ul>
<p dir="auto">The offline policy is yours to design, and the design is mostly about choosing how much revocation lag you can tolerate in exchange for how much offline runway your users need.</p>
]]></description><link>https://fusionauth.io/community/forum/post/8589</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/8589</guid><dc:creator><![CDATA[dan]]></dc:creator><pubDate>Thu, 07 May 2026 14:58:40 GMT</pubDate></item></channel></rss>