@imtf/auth 2.0.0 → 3.0.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/README.md +10 -9
- package/lib/index.esm.js +2 -4
- package/lib/server.esm.js +4 -0
- package/lib/types/index.d.ts +0 -2
- package/lib/types/server.d.ts +3 -0
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ This package supplies IMTF's `better-auth` configuration and a couple of OIDC-fl
|
|
|
27
27
|
```ts
|
|
28
28
|
import "server-only";
|
|
29
29
|
|
|
30
|
-
import { getBetterAuthOptions } from "@imtf/auth";
|
|
30
|
+
import { getBetterAuthOptions } from "@imtf/auth/server";
|
|
31
31
|
import { betterAuth, type BetterAuthOptions } from "better-auth";
|
|
32
32
|
|
|
33
33
|
export const auth = betterAuth({
|
|
@@ -68,7 +68,7 @@ export const POST = handler;
|
|
|
68
68
|
### Federated sign-out route: `app/api/auth/sign-out-url/route.ts`
|
|
69
69
|
|
|
70
70
|
```ts
|
|
71
|
-
import { getSignOutUrlRoute } from "@imtf/auth";
|
|
71
|
+
import { getSignOutUrlRoute } from "@imtf/auth/server";
|
|
72
72
|
import { headers } from "next/headers";
|
|
73
73
|
import { auth } from "@/auth";
|
|
74
74
|
|
|
@@ -124,14 +124,14 @@ function SignOutButton() {
|
|
|
124
124
|
|
|
125
125
|
### Full export list
|
|
126
126
|
|
|
127
|
+
The package has two entry points. `@imtf/auth` is safe to import from client components; `@imtf/auth/server` must only be imported from server code.
|
|
128
|
+
|
|
127
129
|
```ts
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
PROVIDER_ID,
|
|
134
|
-
} from "@imtf/auth";
|
|
130
|
+
// Client-safe — no `better-auth` server code in the module graph.
|
|
131
|
+
import { getBetterAuthClientOptions, useSignOut, PROVIDER_ID } from "@imtf/auth";
|
|
132
|
+
|
|
133
|
+
// Server only — pulls in `better-auth/next-js`, `better-auth/plugins` and `next/headers`.
|
|
134
|
+
import { getBetterAuthOptions, getSignOutUrlRoute, PROVIDER_ID } from "@imtf/auth/server";
|
|
135
135
|
```
|
|
136
136
|
|
|
137
137
|
> `getBetterAuthClientOptions` is deprecated as of `better-auth` 1.7 — generic OAuth sign-in no longer needs a client plugin, so `createAuthClient()` can be called with no options as shown above.
|
|
@@ -164,4 +164,5 @@ pnpm run test:coverage
|
|
|
164
164
|
|
|
165
165
|
- **OAuth callback URL path changed.** The redirect URI that `better-auth` exposes for the generic OIDC provider moved from `{baseURL}/oauth2/callback/{providerId}` to `{baseURL}/callback/{providerId}` (e.g. `https://app.example.com/api/auth/oauth2/callback/oidc-provider` → `https://app.example.com/api/auth/callback/oidc-provider`). **You must update the redirect URI registered with your OIDC provider/IdP client** before deploying this upgrade, or sign-in will fail.
|
|
166
166
|
- **`getSignOutUrlRoute` dropped its `providerId` option.** `better-auth`'s `getAccessToken` API no longer accepts `providerId` to select an account; it now resolves the account from the signed account cookie (`useAccountCookie: true`), matching this package's database-less, `storeAccountCookie: true` configuration. If you were passing `providerId` to `getSignOutUrlRoute`, remove it — it is no longer read.
|
|
167
|
+
- **Server helpers moved to `@imtf/auth/server`.** `getBetterAuthOptions` and `getSignOutUrlRoute` are no longer exported from the package root; update those two imports to `@imtf/auth/server`. The root entry now exposes only the client-safe surface (`PROVIDER_ID`, `useSignOut`, `getBetterAuthClientOptions`). Previously the single barrel re-exported both halves, so any client component importing even a constant from `@imtf/auth` dragged `better-auth`'s server router into the browser bundle — including an unused OpenAPI reference page that loads a script from `cdn.jsdelivr.net`, which reads as a remote-script inclusion to security scanners.
|
|
167
168
|
- **No client plugin is required for generic OAuth sign-in anymore.** `getBetterAuthClientOptions()` no longer registers `genericOAuthClient()` (removed upstream). Generic/custom OAuth providers now sign in through the standard `authClient.signIn.social({ provider })` / `authClient.linkSocial({ provider })` methods. No action needed on your end beyond upgrading — this package's exported options already reflect the change.
|
package/lib/index.esm.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { PROVIDER_ID } from "./constants.esm.js";
|
|
2
|
-
import { getBetterAuthOptions } from "./options/auth.esm.js";
|
|
3
1
|
import { getBetterAuthClientOptions } from "./options/auth-client.esm.js";
|
|
4
|
-
import {
|
|
2
|
+
import { PROVIDER_ID } from "./constants.esm.js";
|
|
5
3
|
import { useSignOut } from "./hooks/useSignOut.esm.js";
|
|
6
|
-
export { PROVIDER_ID, getBetterAuthClientOptions,
|
|
4
|
+
export { PROVIDER_ID, getBetterAuthClientOptions, useSignOut };
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
export { getBetterAuthOptions } from "./options/auth";
|
|
2
1
|
export { getBetterAuthClientOptions } from "./options/auth-client";
|
|
3
|
-
export { getSignOutUrlRoute } from "./routes/getSignOutUrlRoute";
|
|
4
2
|
export { PROVIDER_ID } from "./constants";
|
|
5
3
|
export { useSignOut } from "./hooks/useSignOut";
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imtf/auth",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Better auth wrapper for imtf usage",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "",
|
|
7
7
|
"type": "module",
|
|
8
|
+
"sideEffects": false,
|
|
8
9
|
"files": [
|
|
9
10
|
"lib",
|
|
10
11
|
"schemas"
|
|
@@ -15,10 +16,14 @@
|
|
|
15
16
|
".": {
|
|
16
17
|
"types": "./lib/types/index.d.ts",
|
|
17
18
|
"import": "./lib/index.esm.js"
|
|
19
|
+
},
|
|
20
|
+
"./server": {
|
|
21
|
+
"types": "./lib/types/server.d.ts",
|
|
22
|
+
"import": "./lib/server.esm.js"
|
|
18
23
|
}
|
|
19
24
|
},
|
|
20
25
|
"dependencies": {
|
|
21
|
-
"@imtf/panache": "^6.0.
|
|
26
|
+
"@imtf/panache": "^6.0.1"
|
|
22
27
|
},
|
|
23
28
|
"peerDependencies": {
|
|
24
29
|
"@mui/material": "^7.1.0 || ^9.4.0",
|