@atlasauth/nuxt 0.1.1 → 0.1.3

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/CHANGELOG.md ADDED
@@ -0,0 +1,21 @@
1
+ # @atlasauth/nuxt changelog
2
+
3
+ ## 0.1.3
4
+ - **`frontendApi` is validated at plugin start-up.** A missing (or non-string) or malformed value now throws an
5
+ `AtlasConfigError` (from `@atlasauth/js`; `code: 'FRONTEND_API_REQUIRED'` or `'FRONTEND_API_INVALID'`)
6
+ instead of silently sending requests to relative URLs on the app's own origin. Accepted: an absolute
7
+ `https:` URL (`http:` only for localhost / local development hosts), or `"same-origin"` / a root-relative path such as `"/atlas"` for a reverse proxy.
8
+ The error names the `atlas.frontendApi` option and `NUXT_PUBLIC_ATLAS_FRONTEND_API`.
9
+ - **Deprecated:** `frontendApi: ""` (the original same-origin spelling) still works as same-origin, with a
10
+ one-time console warning; use `"same-origin"` instead. An unset `atlas.frontendApi` (runtimeConfig
11
+ placeholder `""`) behaves the same way.
12
+
13
+ ## 0.1.2
14
+ - **Docs fix.** Frontend API host examples use a single-label host (`your-instance-fapi.atlasauth.net`); the previous two-level `*.fapi.atlasauth.net` form fails TLS behind Cloudflare.
15
+
16
+ ## 0.1.1
17
+ - First published release.
18
+ - **Nuxt 3 module.** Add `@atlasauth/nuxt` to `modules` and configure it under the `atlas` key (`publishableKey`, `frontendApi`, `jwksUrl`, `issuer`, `authorizedParties`). The publishable key and Frontend API URL go to public runtime config; `jwksUrl`, `issuer` and `authorizedParties` stay server-only. `NUXT_PUBLIC_ATLAS_*` / `NUXT_ATLAS_*` environment variables override them at runtime.
19
+ - **Client.** Installs the `@atlasauth/vue` plugin app-wide (also during SSR) and auto-imports its composables (`useAtlas`, `useUser`, `useSession`, `useAuth`, `useOrganization`, `useSignIn`, `useSignUp`, `useFlow`) and components (`SignedIn`, `SignedOut`, `AtlasLoading`, `AtlasLoaded`, `Protect`, `SignIn`, `SignUp`, `UserButton`, `OrganizationSwitcher`, `UserProfile`, `OrganizationProfile`).
20
+ - **Server.** A Nitro middleware verifies the session token (`Authorization` header, else the `__session` cookie) locally on every request and stores the result on `event.context.auth`. `getAtlasAuth(event)` is auto-imported into server routes and returns the verified auth state, including `protect()`.
21
+ - **Cross-domain sign-in.** `atlasHandshake(event)` sends a visitor without a local session through the Atlas handshake once and, on return, redeems the PKCE-bound nonce for a first-party session on your domain.
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
- # @atlas/nuxt
1
+ # @atlasauth/nuxt
2
2
 
3
3
  The official **Nuxt 3** module for [Atlas](https://atlasauth.net). A thin Nuxt
4
- binding: the client half is [`@atlas/vue`](../vue) (the `createAtlas()` plugin,
4
+ binding: the client half is [`@atlasauth/vue`](../vue) (the `createAtlas()` plugin,
5
5
  its composables and components), the server half mirrors
6
- [`@atlas/nextjs`](../nextjs) — it verifies the `__session` JWT **locally** with
7
- `@atlas/backend` inside a Nitro middleware and exposes a `getAtlasAuth(event)`
6
+ [`@atlasauth/nextjs`](../nextjs) — it verifies the `__session` JWT **locally** with
7
+ `@atlasauth/backend` inside a Nitro middleware and exposes a `getAtlasAuth(event)`
8
8
  helper to your server routes.
9
9
 
10
10
  - **No secrets in the browser.** The client holds only the short-lived session
@@ -16,7 +16,7 @@ helper to your server routes.
16
16
  ## Install
17
17
 
18
18
  ```bash
19
- pnpm add @atlas/nuxt
19
+ pnpm add @atlasauth/nuxt
20
20
  ```
21
21
 
22
22
  ## Configure
@@ -28,12 +28,12 @@ server-only `runtimeConfig.atlas`.
28
28
  ```ts
29
29
  // nuxt.config.ts
30
30
  export default defineNuxtConfig({
31
- modules: ['@atlas/nuxt'],
31
+ modules: ['@atlasauth/nuxt'],
32
32
 
33
33
  atlas: {
34
34
  // Public — sent to the browser.
35
35
  publishableKey: 'pk_test_...',
36
- frontendApi: 'https://your-instance.fapi.atlasauth.net',
36
+ frontendApi: 'https://your-instance-fapi.atlasauth.net',
37
37
  },
38
38
 
39
39
  runtimeConfig: {
@@ -57,14 +57,14 @@ In production, prefer environment variables (they override the config above):
57
57
 
58
58
  ```bash
59
59
  NUXT_PUBLIC_ATLAS_PUBLISHABLE_KEY=pk_live_...
60
- NUXT_PUBLIC_ATLAS_FRONTEND_API=https://your-instance.fapi.atlasauth.net
61
- NUXT_ATLAS_JWKS_URL=https://your-instance.fapi.atlasauth.net/.well-known/jwks.json
62
- NUXT_ATLAS_ISSUER=https://your-instance.fapi.atlasauth.net
60
+ NUXT_PUBLIC_ATLAS_FRONTEND_API=https://your-instance-fapi.atlasauth.net
61
+ NUXT_ATLAS_JWKS_URL=https://your-instance-fapi.atlasauth.net/.well-known/jwks.json
62
+ NUXT_ATLAS_ISSUER=https://your-instance-fapi.atlasauth.net
63
63
  ```
64
64
 
65
65
  ## Use in pages and components
66
66
 
67
- Every `@atlas/vue` composable and component is **auto-imported** — no `import`
67
+ Every `@atlasauth/vue` composable and component is **auto-imported** — no `import`
68
68
  line needed.
69
69
 
70
70
  **Components** (`SignedIn`, `SignedOut`, `Protect`, `SignIn`, `SignUp`,
@@ -161,17 +161,17 @@ prefers reading it directly.
161
161
  | `has(condition?)` | boolean check — `permission` / `role` / `anyPermission` / `allPermissions` |
162
162
  | `protect(condition?)` | assert; throws 401 (signed out) / 403 (insufficient) |
163
163
 
164
- You can also `import { getAtlasAuth, verifyCarriers, atlasBackend } from '@atlas/nuxt/server'`
164
+ You can also `import { getAtlasAuth, verifyCarriers, atlasBackend } from '@atlasauth/nuxt/server'`
165
165
  if you prefer explicit imports.
166
166
 
167
167
  ## How it fits together
168
168
 
169
169
  | layer | package | what it does |
170
170
  | -------------------- | -------------- | ----------------------------------------------------------------------- |
171
- | client plugin | `@atlas/vue` | `createAtlas()` installed on the Nuxt Vue app (per request during SSR) |
172
- | composables / comps | `@atlas/vue` | auto-imported into pages/components |
173
- | Nitro middleware | `@atlas/backend` | verifies `__session` once per request → `event.context.auth` |
174
- | `getAtlasAuth` | `@atlas/backend` | the server-route auth helper (local verify, cached JWKS) |
171
+ | client plugin | `@atlasauth/vue` | `createAtlas()` installed on the Nuxt Vue app (per request during SSR) |
172
+ | composables / comps | `@atlasauth/vue` | auto-imported into pages/components |
173
+ | Nitro middleware | `@atlasauth/backend` | verifies `__session` once per request → `event.context.auth` |
174
+ | `getAtlasAuth` | `@atlasauth/backend` | the server-route auth helper (local verify, cached JWKS) |
175
175
 
176
176
  ## Build & test
177
177
 
package/dist/module.d.mts CHANGED
@@ -23,7 +23,12 @@ interface ModuleOptions {
23
23
  * `NUXT_PUBLIC_ATLAS_PUBLISHABLE_KEY` env var in production.
24
24
  */
25
25
  publishableKey?: string;
26
- /** The instance's FAPI origin (e.g. `https://fox.fapi.atlas.dev`). Public. */
26
+ /**
27
+ * The instance's FAPI origin (e.g. `https://fox-fapi.atlasauth.net`), or
28
+ * `"same-origin"` behind a reverse proxy on the app's own origin. Public.
29
+ * Required — set here or via `NUXT_PUBLIC_ATLAS_FRONTEND_API`; the runtime
30
+ * plugin throws an `AtlasConfigError` when neither provides it.
31
+ */
27
32
  frontendApi?: string;
28
33
  /**
29
34
  * The instance's JWKS URL, used by the Nitro side to verify session JWTs.
package/dist/module.d.ts CHANGED
@@ -23,7 +23,12 @@ interface ModuleOptions {
23
23
  * `NUXT_PUBLIC_ATLAS_PUBLISHABLE_KEY` env var in production.
24
24
  */
25
25
  publishableKey?: string;
26
- /** The instance's FAPI origin (e.g. `https://fox.fapi.atlas.dev`). Public. */
26
+ /**
27
+ * The instance's FAPI origin (e.g. `https://fox-fapi.atlasauth.net`), or
28
+ * `"same-origin"` behind a reverse proxy on the app's own origin. Public.
29
+ * Required — set here or via `NUXT_PUBLIC_ATLAS_FRONTEND_API`; the runtime
30
+ * plugin throws an `AtlasConfigError` when neither provides it.
31
+ */
27
32
  frontendApi?: string;
28
33
  /**
29
34
  * The instance's JWKS URL, used by the Nitro side to verify session JWTs.
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.0.0"
6
6
  },
7
- "version": "0.1.1",
7
+ "version": "0.1.3",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "unknown"
@@ -1,12 +1,15 @@
1
+ import { resolveFrontendApi } from "@atlasauth/js";
1
2
  import { createAtlas } from "@atlasauth/vue";
2
3
  import { defineNuxtPlugin, useRuntimeConfig } from "#imports";
3
4
  export default defineNuxtPlugin((nuxtApp) => {
4
5
  const { atlas } = useRuntimeConfig().public;
6
+ resolveFrontendApi(atlas.frontendApi, {
7
+ component: "@atlasauth/nuxt (`atlas.frontendApi` in nuxt.config, or NUXT_PUBLIC_ATLAS_FRONTEND_API)"
8
+ });
5
9
  nuxtApp.vueApp.use(
6
10
  createAtlas({
7
11
  publishableKey: atlas.publishableKey,
8
- // Empty string → let @atlasauth/vue fall back to its default (same-origin FAPI).
9
- frontendApi: atlas.frontendApi || void 0
12
+ frontendApi: atlas.frontendApi
10
13
  })
11
14
  );
12
15
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlasauth/nuxt",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "description": "Official Nuxt 3 module for Atlas — SSR session verification (Nitro) built on the @atlasauth/vue client.",
6
6
  "license": "MIT",
@@ -19,14 +19,15 @@
19
19
  },
20
20
  "files": [
21
21
  "dist",
22
- "README.md"
22
+ "README.md",
23
+ "CHANGELOG.md"
23
24
  ],
24
25
  "dependencies": {
25
26
  "@nuxt/kit": "^3.13.0",
26
- "@atlasauth/vue": "0.1.1",
27
- "@atlasauth/js": "0.1.1",
28
- "@atlasauth/backend": "0.1.1",
29
- "@atlasauth/authz": "0.1.1"
27
+ "@atlasauth/vue": "0.3.0",
28
+ "@atlasauth/js": "0.6.0",
29
+ "@atlasauth/authz": "0.1.1",
30
+ "@atlasauth/backend": "0.7.0"
30
31
  },
31
32
  "peerDependencies": {
32
33
  "nuxt": "^3"