Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

πŸ“ Docs for enabling silent refresh for OIDC tokens

Alicia Sykes687eb48f43b0
diff --git a/docs/authentication.md b/docs/authentication.md
index 60dc44b3..74094e98 100644
--- a/docs/authentication.md
+++ b/docs/authentication.md
@@ -502,6 +502,29 @@ Dashy's server reads `auth.oidc` from `conf.yml` at boot, lazily fetches the OID
Your IdP must include `groups` / `roles` in the id_token, not only the access token, for the admin check to work (most IdPs do this when the `groups` scope is requested).
+
+### Silent token renewal
+
+By default, when your access token expires Dashy sends you back through the provider's login page to get a new one. On a long-lived session this is visible as a brief flash of the sign-out button and a reload. Setting `enableSilentRenew: true` avoids it: Dashy requests a refresh token and uses it to renew the session in the background, before the token expires, with no interactive round-trip.
+
+```yaml
+ oidc:
+ clientId: dashy
+ endpoint: 'https://your-oidc-provider.example.com'
+ scope: 'openid profile email groups'
+ adminGroup: admin
+ enableSilentRenew: true
+```
+
+Notes:
+- It is opt-in and off by default. With it off, nothing changes, existing setups are unaffected.
+- **Your provider must support the `offline_access` scope.** When this is on, Dashy adds `offline_access` to the scope it requests at sign-in, so the provider issues a refresh token. Most providers support this (Authentik, Keycloak, Authelia, Okta, Auth0, Entra/Azure AD). A few do not, most notably **Google**, which uses `access_type=offline` instead and will reject the scope. Do not enable this flag against a provider that rejects `offline_access`, as it would break the interactive sign-in too. If unsure, test sign-in after enabling it.
+- The provider's client/app may also need to be allowed to issue refresh tokens to a public (PKCE) client. In Authentik this is automatic once `offline_access` is an allowed scope.
+- If a silent renewal fails for any reason (no refresh token issued, refresh token expired or revoked, the provider returns no fresh id_token, a provider error), Dashy falls back to the normal interactive sign-in. Renewal can save a round-trip, but the interactive flow always remains the safety net.
+- Renewal is driven by the access token's lifetime. If your provider issues an id_token with a much shorter lifetime than the access token, renewal may lag; keeping the two lifetimes equal (the common default) works best.
+- With multiple tabs open against a provider that rotates refresh tokens on use, tabs can briefly contend for the refresh token; the affected tab simply falls back to interactive sign-in. This is inherent to browser-based refresh tokens, not specific to Dashy.
+
+
---
## authentik
diff --git a/docs/authentication/authelia-oidc.md b/docs/authentication/authelia-oidc.md
index 5cfa6745..5087eb02 100644
--- a/docs/authentication/authelia-oidc.md
+++ b/docs/authentication/authelia-oidc.md
@@ -241,6 +241,37 @@ If Authelia uses a self-signed cert, Dashy's server has to trust it before it ca
Everything should now be fully configured and working πŸŽ‰
When you load Dashy, you'll be redirected to Authelia's login page. After signing in, you'll land back on Dashy's homepage with full access, and all of Dashy's client, server and asset endpoints will be locked behind authentication.
+### Silent token renewal (optional)
+
+By default, when your token expires Dashy sends you back through Authelia's login to get a new one. Set `enableSilentRenew: true` to have Dashy refresh the session quietly in the background instead, using a refresh token:
+
+```yaml
+ oidc:
+ clientId: dashy
+ endpoint: https://authelia.lvh.me:9091
+ adminGroup: admins
+ scope: openid profile email groups
+ enableSilentRenew: true
+```
+
+Dashy adds the `offline_access` scope to its request automatically, but Authelia only issues a refresh token if the client is allowed to. Add `offline_access` to the client's `scopes` and `refresh_token` to its `grant_types`:
+
+```yaml
+ clients:
+ - client_id: dashy
+ scopes:
+ - openid
+ - profile
+ - email
+ - groups
+ - offline_access
+ grant_types:
+ - authorization_code
+ - refresh_token
+```
+
+It's off by default, and if a refresh ever fails Dashy falls back to the normal sign-in. See [silent token renewal](../authentication.md#silent-token-renewal) for the full notes and caveats.
+
---
## 4. Groups and Visibility
diff --git a/docs/authentication/authentik.md b/docs/authentication/authentik.md
index d9d1111c..51b10b71 100644
--- a/docs/authentication/authentik.md
+++ b/docs/authentication/authentik.md
@@ -219,6 +219,21 @@ If Authentik runs on a different host or behind a reverse proxy, make sure `endp
Everything should now be fully configured and working πŸŽ‰
When you load Dashy, you'll be redirected to Authentik's login page. After signing in you will land back on Dashy's homepage with full access, and all of Dashy's client, server and asset endpoints will be locked behind authentication.
+### Silent token renewal (optional)
+
+By default, when your token expires Dashy sends you back through Authentik's login to get a new one. Set `enableSilentRenew: true` to have Dashy refresh the session quietly in the background instead, using a refresh token:
+
+```yaml
+ oidc:
+ clientId: dashy
+ endpoint: https://auth.example.com/application/o/dashy/
+ adminGroup: dashy-admins
+ scope: openid profile email groups
+ enableSilentRenew: true
+```
+
+Dashy adds the `offline_access` scope to its request automatically. Authentik ships an `offline_access` scope mapping by default, so just make sure it's listed under the provider's **Advanced protocol settings > Selected Scopes**. It's off by default, and if a refresh ever fails Dashy falls back to the normal sign-in. See [silent token renewal](../authentication.md#silent-token-renewal) for the full notes and caveats.
+
---
## 4. Groups and Visibility
diff --git a/docs/authentication/pocketid.md b/docs/authentication/pocketid.md
index 0ef9c828..0366fce5 100644
--- a/docs/authentication/pocketid.md
+++ b/docs/authentication/pocketid.md
@@ -175,6 +175,21 @@ If Pocket ID runs behind a reverse proxy, make sure `endpoint` and `APP_URL` agr
Everything should now be fully configured and working πŸŽ‰
When you load Dashy, you'll be redirected to Pocket ID's sign-in page. Authenticate with your passkey (or paste a one-time code), and you'll land back on Dashy with full access. All of Dashy's client, server and asset endpoints will be locked behind authentication.
+### Silent token renewal (optional)
+
+By default, when your token expires Dashy sends you back through Pocket ID's login to get a new one. Set `enableSilentRenew: true` to have Dashy refresh the session quietly in the background instead, using a refresh token:
+
+```yaml
+ oidc:
+ clientId: 268a3701-e9ec-41f6-bad5-87c78ce87c94
+ endpoint: http://localhost:1411
+ adminGroup: admins
+ scope: openid profile email groups
+ enableSilentRenew: true
+```
+
+Dashy adds the `offline_access` scope to its request automatically, and Pocket ID issues a refresh token for it, so nothing needs changing on the Pocket ID side. It's off by default, and if a refresh ever fails Dashy falls back to the normal sign-in. See [silent token renewal](../authentication.md#silent-token-renewal) for the full notes and caveats.
+
---
## 4. Groups and Visibility
diff --git a/docs/authentication/zitadel.md b/docs/authentication/zitadel.md
index bc12e697..cc29328a 100644
--- a/docs/authentication/zitadel.md
+++ b/docs/authentication/zitadel.md
@@ -245,6 +245,21 @@ If Zitadel runs on a different host or behind a reverse proxy, make sure `endpoi
Everything should now be fully configured and working πŸŽ‰
When you load Dashy, you'll be redirected to Zitadel's login page. After signing in, you'll land back on Dashy's homepage with full access, and all of Dashy's client, server and asset endpoints will be locked behind authentication.
+### Silent token renewal (optional)
+
+By default, when your token expires Dashy sends you back through Zitadel's login to get a new one. Set `enableSilentRenew: true` to have Dashy refresh the session quietly in the background instead, using a refresh token:
+
+```yaml
+ oidc:
+ clientId: "1234567890123456789"
+ endpoint: http://zitadel.lvh.me:8080
+ adminGroup: admins
+ scope: openid profile email
+ enableSilentRenew: true
+```
+
+Dashy adds the `offline_access` scope to its request automatically. For Zitadel to issue a refresh token, open the application's **Configuration** and make sure the **Refresh Token** grant type is enabled. It's off by default, and if a refresh ever fails Dashy falls back to the normal sign-in. See [silent token renewal](../authentication.md#silent-token-renewal) for the full notes and caveats.
+
---
## 4. Groups and Visibility
diff --git a/docs/configuring.md b/docs/configuring.md
index bf1c5369..f8c634a9 100644
--- a/docs/configuring.md
+++ b/docs/configuring.md
@@ -219,6 +219,7 @@ For more info, see the **[Authentication Docs](/docs/authentication.md)**
**`adminRole`** | `string` | _Optional_ | The role that will be considered as admin.
**`adminGroup`** | `string` | _Optional_ | The group that will be considered as admin.
**`scope`** | `string` | Required | The scope(s) to request from the OIDC provider
+**`enableSilentRenew`** | `boolean` | _Optional_ | If set to `true`, your session is silently renewed in the background before it expires (only works for providers which support the `offline_access` scope)
**[⬆️ Back to Top](#configuring)**