@merkaly/nuxt 0.11.3 → 0.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -10
- package/dist/module.json +1 -1
- package/dist/runtime/plugins/auth0.client.js +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -35,18 +35,11 @@ On boot the module restores an existing session (user and token) and then runs t
|
|
|
35
35
|
| store | optional | required | `merkaly:tenant` resolves the store from the host (public); a signed-in buyer is restored too; protected pages (account, checkout) ask for login. |
|
|
36
36
|
| www | optional | not used | No hooks; anonymous or signed-in. |
|
|
37
37
|
|
|
38
|
-
### Session lifetime
|
|
38
|
+
### Session lifetime
|
|
39
39
|
|
|
40
|
-
The SPA keeps the session with **refresh tokens
|
|
40
|
+
The SPA keeps the session with **refresh tokens**: the client uses `useRefreshTokens` with `localStorage` cache and logs in with `audience` and `scope: openid profile email offline_access`. Before each API call the module asks Auth0 for the current access token, which is cached and renewed with the refresh token once it expires (2 hours for `https://api.merkaly.io`). When the refresh token is gone or expired, protected surfaces (`requiresAuth: true`) go back to login instead of calling the API without a token. Account linking (`linkWithConnection`) uses a separate client (account.merkaly.io) with an in-memory cache.
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
1. **Application** (type SPA): allowed callback (`/auth`), logout and web origin URLs for each environment.
|
|
45
|
-
2. **Refresh Token Rotation: on**, **Refresh Token Expiration: on**, with idle lifetime `2592000` (30 days) and maximum lifetime `7776000` (90 days). Never non-rotating or non-expiring.
|
|
46
|
-
3. **API `https://api.merkaly.io`**: "Allow Offline Access" stays **on**; without it Auth0 issues no refresh tokens and every session ends after 2 hours.
|
|
47
|
-
4. **Organizations**: apps that work inside a store (admin) require an organization at login; staff-only apps are filtered by the "Enforce surface access" post-login Action (role `MK_*`).
|
|
48
|
-
|
|
49
|
-
These settings can be read and changed through the Management API (`merkaly.us.auth0.com`, the canonical domain, never the custom `auth.merkaly.io`).
|
|
42
|
+
The Auth0 side (tenant, API, app settings, refresh token rotation and lifetimes, organizations, and the checklist for a new app) is documented in the auth.merkaly.io repo: [`docs/tenant-setup.md`](https://github.com/merkaly-io/auth.merkaly.io/blob/master/docs/tenant-setup.md).
|
|
50
43
|
|
|
51
44
|
## SEO: robots and sitemap
|
|
52
45
|
|
package/dist/module.json
CHANGED
|
@@ -47,6 +47,9 @@ export default defineNuxtPlugin(async ({ callHook, hook }) => {
|
|
|
47
47
|
return auth0.loginWithRedirect({ appState: { target: location.pathname + location.search } });
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
+
if (!user.value && $config.merkaly.auth0.requiresAuth) {
|
|
51
|
+
return auth0.loginWithRedirect({ appState: { target: location.pathname + location.search } });
|
|
52
|
+
}
|
|
50
53
|
return initTenantContext();
|
|
51
54
|
};
|
|
52
55
|
hook("merkaly:auth:retry", () => resolveIdentity().then(startSession));
|