@better-auth/sso 1.4.0-beta.15 → 1.4.0-beta.16

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @better-auth/sso@1.4.0-beta.15 build /home/runner/work/better-auth/better-auth/packages/sso
2
+ > @better-auth/sso@1.4.0-beta.16 build /home/runner/work/better-auth/better-auth/packages/sso
3
3
  > tsdown
4
4
 
5
5
  ℹ tsdown v0.15.11 powered by rolldown v1.0.0-beta.45
@@ -7,19 +7,11 @@
7
7
  ℹ entry: src/client.ts, src/index.ts
8
8
  ℹ tsconfig: tsconfig.json
9
9
  ℹ Build start
10
- ℹ [CJS] dist/client.cjs  0.19 kB │ gzip: 0.16 kB
11
- ℹ [CJS] dist/index.cjs  0.08 kB │ gzip: 0.08 kB
12
- ℹ [CJS] dist/src-BsLnNXTo.cjs 52.34 kB │ gzip: 9.21 kB
13
- ℹ [CJS] 3 files, total: 52.61 kB
14
- ℹ [ESM] dist/client.js  0.18 kB │ gzip: 0.16 kB
15
- ℹ [ESM] dist/index.js  0.06 kB │ gzip: 0.07 kB
16
- ℹ [ESM] dist/src-BEPbgggK.js 49.59 kB │ gzip: 8.54 kB
17
- ℹ [ESM] dist/index.d.ts  0.24 kB │ gzip: 0.16 kB
18
- ℹ [ESM] dist/client.d.ts  0.21 kB │ gzip: 0.18 kB
19
- ℹ [ESM] dist/index-CdeDxbNh.d.ts 22.04 kB │ gzip: 3.15 kB
20
- ℹ [ESM] 6 files, total: 72.32 kB
21
- ℹ [CJS] dist/index.d.cts  0.24 kB │ gzip: 0.16 kB
22
- ℹ [CJS] dist/client.d.cts  0.21 kB │ gzip: 0.18 kB
23
- ℹ [CJS] dist/index-DJAIa5j3.d.cts 22.04 kB │ gzip: 3.16 kB
24
- ℹ [CJS] 3 files, total: 22.50 kB
25
- ✔ Build complete in 9377ms
10
+ ℹ dist/client.js  0.18 kB │ gzip: 0.16 kB
11
+ ℹ dist/index.js  0.06 kB │ gzip: 0.07 kB
12
+ ℹ dist/src-BrnaMP1W.js 49.60 kB │ gzip: 8.54 kB
13
+ ℹ dist/index.d.ts  0.24 kB │ gzip: 0.16 kB
14
+ ℹ dist/client.d.ts  0.21 kB │ gzip: 0.18 kB
15
+ ℹ dist/index-U95aRHHN.d.ts 22.51 kB │ gzip: 3.39 kB
16
+ ℹ 6 files, total: 72.81 kB
17
+ ✔ Build complete in 11363ms
package/dist/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { s as sso } from "./index-CdeDxbNh.js";
1
+ import { s as sso } from "./index-U95aRHHN.js";
2
2
 
3
3
  //#region src/client.d.ts
4
4
  declare const ssoClient: () => {
package/dist/client.js CHANGED
@@ -1,4 +1,4 @@
1
- import "./src-BEPbgggK.js";
1
+ import "./src-BrnaMP1W.js";
2
2
 
3
3
  //#region src/client.ts
4
4
  const ssoClient = () => {
@@ -181,6 +181,12 @@ interface SSOOptions {
181
181
  providersLimit?: (number | ((user: User) => Promise<number> | number)) | undefined;
182
182
  /**
183
183
  * Trust the email verified flag from the provider.
184
+ *
185
+ * ⚠️ Use this with caution — it can lead to account takeover if misused. Only enable it if users **cannot freely register new providers**. You can
186
+ * prevent that by using `disabledPaths` or other safeguards to block provider registration from the client.
187
+ *
188
+ * If you want to allow account linking for specific trusted providers, enable the `accountLinking` option in your auth config and specify those
189
+ * providers in the `trustedProviders` list.
184
190
  * @default false
185
191
  */
186
192
  trustEmailVerified?: boolean | undefined;
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as SSOOptions, i as SAMLMapping, n as OIDCMapping, o as SSOProvider, r as SAMLConfig, s as sso, t as OIDCConfig } from "./index-CdeDxbNh.js";
1
+ import { a as SSOOptions, i as SAMLMapping, n as OIDCMapping, o as SSOProvider, r as SAMLConfig, s as sso, t as OIDCConfig } from "./index-U95aRHHN.js";
2
2
  export { OIDCConfig, OIDCMapping, SAMLConfig, SAMLMapping, SSOOptions, SSOProvider, sso };
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { t as sso } from "./src-BEPbgggK.js";
1
+ import { t as sso } from "./src-BrnaMP1W.js";
2
2
 
3
3
  export { sso };
@@ -504,7 +504,7 @@ const sso = (options) => {
504
504
  if (body.providerType === "saml" && !provider.samlConfig) throw new APIError("BAD_REQUEST", { message: "SAML provider is not configured" });
505
505
  }
506
506
  if (provider.oidcConfig && body.providerType !== "saml") {
507
- const state = await generateState(ctx);
507
+ const state = await generateState(ctx, void 0, false);
508
508
  const redirectURI = `${ctx.context.baseURL}/sso/callback/${provider.providerId}`;
509
509
  const authorizationURL = await createAuthorizationURL({
510
510
  id: provider.issuer,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@better-auth/sso",
3
3
  "author": "Bereket Engida",
4
- "version": "1.4.0-beta.15",
4
+ "version": "1.4.0-beta.16",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "homepage": "https://www.better-auth.com/docs/plugins/sso",
@@ -32,14 +32,12 @@
32
32
  ".": {
33
33
  "better-auth-dev-source": "./src/index.ts",
34
34
  "types": "./dist/index.d.ts",
35
- "import": "./dist/index.js",
36
- "require": "./dist/index.cjs"
35
+ "default": "./dist/index.js"
37
36
  },
38
37
  "./client": {
39
38
  "better-auth-dev-source": "./src/client.ts",
40
39
  "types": "./dist/client.d.ts",
41
- "import": "./dist/client.js",
42
- "require": "./dist/client.cjs"
40
+ "default": "./dist/client.js"
43
41
  }
44
42
  },
45
43
  "typesVersions": {
@@ -56,7 +54,6 @@
56
54
  "@better-fetch/fetch": "1.1.18",
57
55
  "fast-xml-parser": "^5.2.5",
58
56
  "jose": "^6.1.0",
59
- "oauth2-mock-server": "^7.2.1",
60
57
  "samlify": "^2.10.1",
61
58
  "zod": "^4.1.5"
62
59
  },
@@ -66,11 +63,12 @@
66
63
  "better-call": "1.0.24",
67
64
  "body-parser": "^2.2.0",
68
65
  "express": "^5.1.0",
66
+ "oauth2-mock-server": "^7.2.1",
69
67
  "tsdown": "^0.15.11",
70
- "better-auth": "^1.4.0-beta.15"
68
+ "better-auth": "^1.4.0-beta.16"
71
69
  },
72
70
  "peerDependencies": {
73
- "better-auth": "1.4.0-beta.15"
71
+ "better-auth": "1.4.0-beta.16"
74
72
  },
75
73
  "scripts": {
76
74
  "test": "vitest",
package/src/index.ts CHANGED
@@ -260,6 +260,12 @@ export interface SSOOptions {
260
260
  | undefined;
261
261
  /**
262
262
  * Trust the email verified flag from the provider.
263
+ *
264
+ * ⚠️ Use this with caution — it can lead to account takeover if misused. Only enable it if users **cannot freely register new providers**. You can
265
+ * prevent that by using `disabledPaths` or other safeguards to block provider registration from the client.
266
+ *
267
+ * If you want to allow account linking for specific trusted providers, enable the `accountLinking` option in your auth config and specify those
268
+ * providers in the `trustedProviders` list.
263
269
  * @default false
264
270
  */
265
271
  trustEmailVerified?: boolean | undefined;
@@ -1149,7 +1155,7 @@ export const sso = (options?: SSOOptions | undefined) => {
1149
1155
  }
1150
1156
  }
1151
1157
  if (provider.oidcConfig && body.providerType !== "saml") {
1152
- const state = await generateState(ctx);
1158
+ const state = await generateState(ctx, undefined, false);
1153
1159
  const redirectURI = `${ctx.context.baseURL}/sso/callback/${provider.providerId}`;
1154
1160
  const authorizationURL = await createAuthorizationURL({
1155
1161
  id: provider.issuer,
package/tsdown.config.ts CHANGED
@@ -2,7 +2,7 @@ import { defineConfig } from "tsdown";
2
2
 
3
3
  export default defineConfig({
4
4
  dts: { build: true, incremental: true },
5
- format: ["esm", "cjs"],
5
+ format: ["esm"],
6
6
  entry: ["./src/index.ts", "./src/client.ts"],
7
7
  external: ["better-auth", "better-call", "@better-fetch/fetch", "stripe"],
8
8
  });
package/dist/client.cjs DELETED
@@ -1,12 +0,0 @@
1
- require('./src-BsLnNXTo.cjs');
2
-
3
- //#region src/client.ts
4
- const ssoClient = () => {
5
- return {
6
- id: "sso-client",
7
- $InferServerPlugin: {}
8
- };
9
- };
10
-
11
- //#endregion
12
- exports.ssoClient = ssoClient;
package/dist/client.d.cts DELETED
@@ -1,9 +0,0 @@
1
- import { s as sso } from "./index-DJAIa5j3.cjs";
2
-
3
- //#region src/client.d.ts
4
- declare const ssoClient: () => {
5
- id: "sso-client";
6
- $InferServerPlugin: ReturnType<typeof sso>;
7
- };
8
- //#endregion
9
- export { ssoClient };