@aiveth/nextjs 0.4.1 → 0.5.0

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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.0 — 2026-11-26
4
+
5
+ - `audience` / env `AIVETH_API_AUDIENCE`: your own API's address. `getAccessToken()` then gives a signed token for that API, which it checks with `verifyAccessToken` (`@aiveth/node`).
6
+
3
7
  ## 0.4.1 — 2026-11-25
4
8
 
5
9
  - `/auth/branding` is never cached (it was 5 minutes): a Save in Aiveth → Branding shows on
package/README.md CHANGED
@@ -16,6 +16,7 @@ AIVETH_CLIENT_ID=okc_...
16
16
  AIVETH_CLIENT_SECRET=oks_...
17
17
  AIVETH_COOKIE_SECRET=$(openssl rand -base64 32) # at least 32 characters
18
18
  AIVETH_APP_URL=https://your-app.com
19
+ # AIVETH_API_AUDIENCE=https://api.your-app.com # optional: a signed token for your own API (Developers → Your APIs)
19
20
  ```
20
21
 
21
22
  3. `proxy.ts` (Next.js 16) — or `middleware.ts` (15):
package/dist/config.d.ts CHANGED
@@ -11,6 +11,10 @@ export interface AivethNextConfig {
11
11
  appUrl: string;
12
12
  /** Space-separated. `offline_access` keeps the person signed in past the access token. */
13
13
  scope: string;
14
+ /** Your own API's address, as registered under Developers → Your APIs (env
15
+ * `AIVETH_API_AUDIENCE`). Set it and `getAccessToken()` gives a signed token for that API, which
16
+ * it checks with `verifyAccessToken` (`@aiveth/node`) — no call to Aiveth. */
17
+ audience?: string;
14
18
  /** For tests, or a runtime without a global fetch. */
15
19
  fetch?: typeof fetch;
16
20
  }
package/dist/config.js CHANGED
@@ -49,6 +49,7 @@ function fromEnv() {
49
49
  cookieSecret: env.AIVETH_COOKIE_SECRET ?? '',
50
50
  appUrl: env.AIVETH_APP_URL ?? '',
51
51
  scope: env.AIVETH_SCOPES || DEFAULT_SCOPE,
52
+ audience: env.AIVETH_API_AUDIENCE || undefined,
52
53
  };
53
54
  }
54
55
  export function config() {
package/dist/oidc.js CHANGED
@@ -54,6 +54,8 @@ export async function authorizeUrl(c, a) {
54
54
  });
55
55
  if (a.loginHint)
56
56
  q.set('login_hint', a.loginHint);
57
+ if (c.audience)
58
+ q.set('resource', c.audience); // RFC 8707: a signed access token for that API
57
59
  return `${d.authorization_endpoint}?${q}`;
58
60
  }
59
61
  async function token(c, form) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiveth/nextjs",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Aiveth by Gooclaim for Next.js: sign in on Aiveth's page, an encrypted session cookie, the user on the server and in the browser.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Gooclaim",