@better-auth/core 1.4.8-beta.7 → 1.4.9

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/core@1.4.8-beta.7 build /home/runner/work/better-auth/better-auth/packages/core
2
+ > @better-auth/core@1.4.9 build /home/runner/work/better-auth/better-auth/packages/core
3
3
  > tsdown
4
4
 
5
5
  ℹ tsdown v0.17.2 powered by rolldown v1.0.0-beta.53
@@ -7,7 +7,7 @@
7
7
  ℹ entry: src/index.ts, src/db/index.ts, src/db/adapter/index.ts, src/async_hooks/index.ts, src/async_hooks/pure.index.ts, src/context/index.ts, src/env/index.ts, src/oauth2/index.ts, src/api/index.ts, src/social-providers/index.ts, src/utils/index.ts, src/error/index.ts
8
8
  ℹ tsconfig: tsconfig.json
9
9
  ℹ Build start
10
- ℹ dist/social-providers/index.mjs  80.60 kB │ gzip: 10.30 kB
10
+ ℹ dist/social-providers/index.mjs  80.96 kB │ gzip: 10.43 kB
11
11
  ℹ dist/db/adapter/index.mjs  38.55 kB │ gzip: 7.86 kB
12
12
  ℹ dist/db/index.mjs  1.66 kB │ gzip: 0.54 kB
13
13
  ℹ dist/api/index.mjs  1.23 kB │ gzip: 0.48 kB
@@ -39,5 +39,5 @@
39
39
  ℹ dist/async_hooks/pure.index.d.mts  0.22 kB │ gzip: 0.16 kB
40
40
  ℹ dist/index-Zbo6xPkd.d.mts 221.47 kB │ gzip: 35.34 kB
41
41
  ℹ dist/index-BRBu0-5h.d.mts  3.31 kB │ gzip: 1.11 kB
42
- ℹ 32 files, total: 400.40 kB
43
- ✔ Build complete in 4875ms
42
+ ℹ 32 files, total: 400.76 kB
43
+ ✔ Build complete in 4832ms
@@ -203,7 +203,7 @@ const cognito = (options) => {
203
203
  ];
204
204
  if (options.scope) _scopes.push(...options.scope);
205
205
  if (scopes) _scopes.push(...scopes);
206
- return await createAuthorizationURL({
206
+ const url = await createAuthorizationURL({
207
207
  id: "cognito",
208
208
  options: { ...options },
209
209
  authorizationEndpoint,
@@ -213,6 +213,15 @@ const cognito = (options) => {
213
213
  redirectURI,
214
214
  prompt: options.prompt
215
215
  });
216
+ const scopeValue = url.searchParams.get("scope");
217
+ if (scopeValue) {
218
+ url.searchParams.delete("scope");
219
+ const encodedScope = encodeURIComponent(scopeValue);
220
+ const urlString = url.toString();
221
+ const separator = urlString.includes("?") ? "&" : "?";
222
+ return new URL(`${urlString}${separator}scope=${encodedScope}`);
223
+ }
224
+ return url;
216
225
  },
217
226
  validateAuthorizationCode: async ({ code, codeVerifier, redirectURI }) => {
218
227
  return validateAuthorizationCode({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-auth/core",
3
- "version": "1.4.8-beta.7",
3
+ "version": "1.4.9",
4
4
  "description": "The most comprehensive authentication framework for TypeScript.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -92,6 +92,17 @@ export const cognito = (options: CognitoOptions) => {
92
92
  redirectURI,
93
93
  prompt: options.prompt,
94
94
  });
95
+ // AWS Cognito requires scopes to be encoded with %20 instead of +
96
+ // URLSearchParams encodes spaces as + by default, so we need to fix this
97
+ const scopeValue = url.searchParams.get("scope");
98
+ if (scopeValue) {
99
+ url.searchParams.delete("scope");
100
+ const encodedScope = encodeURIComponent(scopeValue);
101
+ // Manually append the scope with proper encoding to the URL
102
+ const urlString = url.toString();
103
+ const separator = urlString.includes("?") ? "&" : "?";
104
+ return new URL(`${urlString}${separator}scope=${encodedScope}`);
105
+ }
95
106
  return url;
96
107
  },
97
108