nuxt-auth-utils 0.5.25 → 0.5.27

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.
Files changed (71) hide show
  1. package/README.md +30 -6
  2. package/dist/module.d.mts +3 -4
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +21 -6
  5. package/dist/runtime/app/components/AuthState.vue.d.ts +7 -6
  6. package/dist/runtime/server/api/session.get.d.ts +1 -5
  7. package/dist/runtime/server/lib/atproto/bluesky.d.ts +1 -1
  8. package/dist/runtime/server/lib/oauth/apple.d.ts +1 -1
  9. package/dist/runtime/server/lib/oauth/atlassian.d.ts +1 -1
  10. package/dist/runtime/server/lib/oauth/auth0.d.ts +1 -1
  11. package/dist/runtime/server/lib/oauth/authentik.d.ts +1 -1
  12. package/dist/runtime/server/lib/oauth/azureb2c.d.ts +1 -1
  13. package/dist/runtime/server/lib/oauth/azureb2c.js +0 -1
  14. package/dist/runtime/server/lib/oauth/battledotnet.d.ts +1 -1
  15. package/dist/runtime/server/lib/oauth/cognito.d.ts +1 -1
  16. package/dist/runtime/server/lib/oauth/discord.d.ts +1 -1
  17. package/dist/runtime/server/lib/oauth/dropbox.d.ts +1 -1
  18. package/dist/runtime/server/lib/oauth/facebook.d.ts +1 -1
  19. package/dist/runtime/server/lib/oauth/gitea.d.ts +1 -1
  20. package/dist/runtime/server/lib/oauth/github.d.ts +1 -1
  21. package/dist/runtime/server/lib/oauth/gitlab.d.ts +1 -1
  22. package/dist/runtime/server/lib/oauth/google.d.ts +1 -1
  23. package/dist/runtime/server/lib/oauth/heroku.d.ts +1 -1
  24. package/dist/runtime/server/lib/oauth/hubspot.d.ts +1 -1
  25. package/dist/runtime/server/lib/oauth/instagram.d.ts +1 -1
  26. package/dist/runtime/server/lib/oauth/keycloak.d.ts +1 -1
  27. package/dist/runtime/server/lib/oauth/kick.d.ts +1 -1
  28. package/dist/runtime/server/lib/oauth/line.d.ts +1 -1
  29. package/dist/runtime/server/lib/oauth/linear.d.ts +1 -1
  30. package/dist/runtime/server/lib/oauth/linkedin.d.ts +1 -1
  31. package/dist/runtime/server/lib/oauth/livechat.d.ts +2 -3
  32. package/dist/runtime/server/lib/oauth/livechat.js +1 -3
  33. package/dist/runtime/server/lib/oauth/microsoft.d.ts +1 -1
  34. package/dist/runtime/server/lib/oauth/oidc.d.ts +216 -0
  35. package/dist/runtime/server/lib/oauth/oidc.js +83 -0
  36. package/dist/runtime/server/lib/oauth/okta.d.ts +1 -1
  37. package/dist/runtime/server/lib/oauth/ory.d.ts +1 -1
  38. package/dist/runtime/server/lib/oauth/ory.js +1 -1
  39. package/dist/runtime/server/lib/oauth/paypal.d.ts +1 -1
  40. package/dist/runtime/server/lib/oauth/polar.d.ts +1 -1
  41. package/dist/runtime/server/lib/oauth/roblox.d.ts +1 -1
  42. package/dist/runtime/server/lib/oauth/salesforce.d.ts +1 -1
  43. package/dist/runtime/server/lib/oauth/seznam.d.ts +1 -1
  44. package/dist/runtime/server/lib/oauth/shopifyCustomer.d.ts +26 -0
  45. package/dist/runtime/server/lib/oauth/shopifyCustomer.js +90 -0
  46. package/dist/runtime/server/lib/oauth/slack.d.ts +1 -1
  47. package/dist/runtime/server/lib/oauth/spotify.d.ts +1 -1
  48. package/dist/runtime/server/lib/oauth/steam.d.ts +1 -1
  49. package/dist/runtime/server/lib/oauth/steam.js +2 -1
  50. package/dist/runtime/server/lib/oauth/strava.d.ts +1 -1
  51. package/dist/runtime/server/lib/oauth/tiktok.d.ts +1 -1
  52. package/dist/runtime/server/lib/oauth/twitch.d.ts +1 -1
  53. package/dist/runtime/server/lib/oauth/vk.d.ts +1 -1
  54. package/dist/runtime/server/lib/oauth/workos.d.ts +1 -1
  55. package/dist/runtime/server/lib/oauth/x.d.ts +1 -1
  56. package/dist/runtime/server/lib/oauth/x.js +18 -12
  57. package/dist/runtime/server/lib/oauth/xsuaa.d.ts +1 -1
  58. package/dist/runtime/server/lib/oauth/yandex.d.ts +1 -1
  59. package/dist/runtime/server/lib/oauth/zitadel.d.ts +1 -1
  60. package/dist/runtime/server/lib/oauth/zitadel.js +5 -4
  61. package/dist/runtime/server/lib/utils.d.ts +9 -9
  62. package/dist/runtime/server/lib/utils.js +36 -20
  63. package/dist/runtime/server/lib/webauthn/register.js +2 -1
  64. package/dist/runtime/server/plugins/oauth.d.ts +1 -1
  65. package/dist/runtime/server/utils/password.d.ts +17 -0
  66. package/dist/runtime/server/utils/password.js +3 -0
  67. package/dist/runtime/server/utils/session.d.ts +3 -2
  68. package/dist/runtime/types/oauth-config.d.ts +1 -1
  69. package/dist/runtime/types/utils.d.ts +14 -0
  70. package/dist/runtime/types/webauthn.d.ts +1 -0
  71. package/package.json +18 -18
package/README.md CHANGED
@@ -156,11 +156,8 @@ const session = await requireUserSession(event)
156
156
 
157
157
  You can define the type for your user session by creating a type declaration file (for example, `auth.d.ts`) in your project to augment the `UserSession` type:
158
158
 
159
- > [!NOTE]
160
- > If you are using Nuxt >=4.0.0 or compatibility version 4 add the `auth.d.ts` file to the `shared` directory to get the correct types in server and client.
161
-
162
159
  ```ts
163
- // auth.d.ts
160
+ // shared/types/auth.d.ts
164
161
  declare module '#auth-utils' {
165
162
  interface User {
166
163
  // Add your own fields
@@ -239,12 +236,14 @@ It can also be set using environment variables:
239
236
  - LinkedIn
240
237
  - LiveChat
241
238
  - Microsoft
239
+ - OIDC / OpenID Connect (Generic)
242
240
  - Okta
243
241
  - Ory
244
242
  - PayPal
245
243
  - Polar
246
244
  - Salesforce
247
245
  - Seznam
246
+ - Shopify Customer
248
247
  - Slack
249
248
  - Spotify
250
249
  - Steam
@@ -301,6 +300,17 @@ if (await verifyPassword(hashedPassword, 'user_password')) {
301
300
  }
302
301
  ```
303
302
 
303
+ It also provides a `passwordNeedsRehash` function to check if a password needs to be rehashed. This is useful when the hash settings are changed, such as as increasing the scrypt cost parameters.
304
+
305
+ ```ts
306
+ const needsRehash = await passwordNeedsRehash(hashedPassword)
307
+
308
+ if (needsRehash) {
309
+ // Password needs to be rehashed
310
+ hashedPassword = await hashPassword('user_password')
311
+ }
312
+ ```
313
+
304
314
  You can configure the scrypt options in your `nuxt.config.ts`:
305
315
 
306
316
  ```ts
@@ -411,7 +421,7 @@ export default defineWebAuthnRegisterEventHandler({
411
421
  // If he registers a new account with credentials
412
422
  return z.object({
413
423
  // we want the userName to be a valid email
414
- userName: z.string().email()
424
+ userName: z.string().email()
415
425
  }).parse(userBody)
416
426
  },
417
427
  async onSuccess(event, { credential, user }) {
@@ -600,7 +610,7 @@ This is because the user session is stored in a secure cookie and cannot be acce
600
610
 
601
611
  **This means that you should not rely on the user session during prerendering.**
602
612
 
603
- You may also choose to instruct Nuxt AUth Utils to fetch the user session only on the client side, with the `loadStrategy` option in your `nuxt.config.ts`:
613
+ You may also choose to instruct Nuxt Auth Utils to fetch the user session only on the client side, with the `loadStrategy` option in your `nuxt.config.ts`:
604
614
 
605
615
  ```ts
606
616
  export default defineNuxtConfig({
@@ -612,6 +622,20 @@ export default defineNuxtConfig({
612
622
 
613
623
  When using the `client-only` load strategy, the user session can still be manually fetched on the server side by calling `fetch` from the `useUserSession` composable.
614
624
 
625
+ ### Disable session loading
626
+
627
+ You may also choose to disable session loading entirely, with the `loadStrategy` option in your `nuxt.config.ts`:
628
+
629
+ ```ts
630
+ export default defineNuxtConfig({
631
+ auth: {
632
+ loadStrategy: 'none'
633
+ }
634
+ })
635
+ ```
636
+
637
+ When using the `none` load strategy, the user session can still be manually fetched by calling `useUserSession().fetch()`.
638
+
615
639
  ### `<AuthState>` component
616
640
 
617
641
  You can use the `<AuthState>` component to safely display auth-related data in your components without worrying about the rendering mode.
package/dist/module.d.mts CHANGED
@@ -1,4 +1,3 @@
1
- import * as _nuxt_schema from '@nuxt/schema';
2
1
  import { ScryptConfig } from '@adonisjs/hash/types';
3
2
  import { SessionConfig } from 'h3';
4
3
 
@@ -26,7 +25,7 @@ interface ModuleOptions {
26
25
  * Session load strategy
27
26
  * @default 'server-first'
28
27
  */
29
- loadStrategy?: 'server-first' | 'client-only';
28
+ loadStrategy?: 'server-first' | 'client-only' | 'none';
30
29
  }
31
30
  declare module 'nuxt/schema' {
32
31
  interface RuntimeConfig {
@@ -40,11 +39,11 @@ declare module 'nuxt/schema' {
40
39
  }
41
40
  interface PublicRuntimeConfig {
42
41
  auth: {
43
- loadStrategy: 'server-first' | 'client-only';
42
+ loadStrategy: 'server-first' | 'client-only' | 'none';
44
43
  };
45
44
  }
46
45
  }
47
- declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
46
+ declare const _default: any;
48
47
 
49
48
  export { _default as default };
50
49
  export type { ModuleOptions };
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "auth-utils",
3
3
  "configKey": "auth",
4
- "version": "0.5.25",
4
+ "version": "0.5.27",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -1,11 +1,11 @@
1
- import { readFile, writeFile } from 'node:fs/promises';
2
1
  import { defineNuxtModule, createResolver, addComponentsDir, addImports, addPlugin, addServerPlugin, addServerImportsDir, logger, addServerHandler } from '@nuxt/kit';
3
- import { join } from 'pathe';
4
2
  import { defu } from 'defu';
3
+ import { readFile, writeFile } from 'node:fs/promises';
4
+ import { join } from 'pathe';
5
5
  import { randomUUID } from 'uncrypto';
6
6
  import { atprotoProviders, atprotoProviderDefaultClientMetadata, getClientMetadataFilename } from '../dist/runtime/utils/atproto.js';
7
7
 
8
- const module = defineNuxtModule({
8
+ const module$1 = defineNuxtModule({
9
9
  meta: {
10
10
  name: "auth-utils",
11
11
  configKey: "auth"
@@ -32,8 +32,10 @@ const module = defineNuxtModule({
32
32
  }
33
33
  addComponentsDir({ path: resolver.resolve("./runtime/app/components") });
34
34
  addImports(composables);
35
- addPlugin(resolver.resolve("./runtime/app/plugins/session.server"));
36
- addPlugin(resolver.resolve("./runtime/app/plugins/session.client"));
35
+ if (options.loadStrategy !== "none") {
36
+ addPlugin(resolver.resolve("./runtime/app/plugins/session.server"));
37
+ addPlugin(resolver.resolve("./runtime/app/plugins/session.client"));
38
+ }
37
39
  addServerPlugin(resolver.resolve("./runtime/server/plugins/oauth"));
38
40
  addServerImportsDir(resolver.resolve("./runtime/server/lib/oauth"));
39
41
  if (nuxt.options.nitro?.experimental?.websocket) {
@@ -385,7 +387,20 @@ const module = defineNuxtModule({
385
387
  tokenURL: "",
386
388
  userURL: ""
387
389
  });
390
+ runtimeConfig.oauth.shopifyCustomer = defu(runtimeConfig.oauth.shopifyCustomer, {
391
+ shopDomain: "",
392
+ clientId: "",
393
+ redirectURL: "",
394
+ scope: []
395
+ });
396
+ runtimeConfig.oauth.oidc = defu(runtimeConfig.oauth.oidc, {
397
+ clientId: "",
398
+ clientSecret: "",
399
+ openidConfig: "",
400
+ redirectURL: "",
401
+ scope: []
402
+ });
388
403
  }
389
404
  });
390
405
 
391
- export { module as default };
406
+ export { module$1 as default };
@@ -1,16 +1,17 @@
1
1
  declare var __VLS_1: {
2
- loggedIn: boolean;
3
- user: import("../../types/index.js").User | null;
4
- session: import("../../types/index.js").UserSession | null;
5
- clear: () => Promise<void>;
2
+ loggedIn: any;
3
+ user: any;
4
+ session: any;
5
+ clear: any;
6
6
  }, __VLS_3: {};
7
7
  type __VLS_Slots = {} & {
8
8
  default?: (props: typeof __VLS_1) => any;
9
9
  } & {
10
10
  placeholder?: (props: typeof __VLS_3) => any;
11
11
  };
12
- declare const __VLS_component: import("vue-demi").DefineComponent<{}, {}, {}, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, {}, string, import("vue-demi").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue-demi").ComponentProvideOptions, true, {}, any>;
13
- declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
12
+ declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
13
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
14
+ declare const _default: typeof __VLS_export;
14
15
  export default _default;
15
16
  type __VLS_WithSlots<T, S> = T & {
16
17
  new (): {
@@ -1,6 +1,2 @@
1
- declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<{
2
- [key: string]: unknown;
3
- id: string;
4
- user?: import("../../types/index.js").User;
5
- }>>;
1
+ declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<UserSession>>;
6
2
  export default _default;
@@ -22,7 +22,7 @@ type BlueSkyTokens = NodeSavedSession['tokenSet'];
22
22
  export declare function defineOAuthBlueskyEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthBlueskyConfig, {
23
23
  user: BlueSkyUser;
24
24
  tokens: BlueSkyTokens;
25
- }>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
25
+ }>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
26
26
  export declare class StateStore implements NodeSavedStateStore {
27
27
  private event;
28
28
  private readonly stateKey;
@@ -74,4 +74,4 @@ export declare function defineOAuthAppleEventHandler({ config, onSuccess, onErro
74
74
  user: OAuthAppleUser;
75
75
  payload: OAuthAppleTokens;
76
76
  tokens: any;
77
- }>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
77
+ }>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
@@ -91,5 +91,5 @@ export interface OAuthAtlassianConfig {
91
91
  export declare function defineOAuthAtlassianEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthAtlassianConfig, {
92
92
  user: AtlassianUser;
93
93
  tokens: AtlassianTokens;
94
- }>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
94
+ }>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
95
95
  export {};
@@ -57,4 +57,4 @@ export interface OAuthAuth0Config {
57
57
  */
58
58
  redirectURL?: string;
59
59
  }
60
- export declare function defineOAuthAuth0EventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthAuth0Config>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
60
+ export declare function defineOAuthAuth0EventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthAuth0Config>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
@@ -27,4 +27,4 @@ export interface OAuthAuthentikConfig {
27
27
  */
28
28
  scope?: string[];
29
29
  }
30
- export declare function defineOAuthAuthentikEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthAuthentikConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
30
+ export declare function defineOAuthAuthentikEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthAuthentikConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
@@ -51,4 +51,4 @@ export interface OAuthAzureB2CConfig {
51
51
  */
52
52
  redirectURL?: string;
53
53
  }
54
- export declare function defineOAuthAzureB2CEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthAzureB2CConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
54
+ export declare function defineOAuthAzureB2CEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthAzureB2CConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
@@ -37,7 +37,6 @@ export function defineOAuthAzureB2CEventHandler({ config, onSuccess, onError })
37
37
  if (query.state !== state) {
38
38
  return handleInvalidState(event, "azureb2c", onError);
39
39
  }
40
- console.info("code verifier", verifier.code_verifier);
41
40
  const tokens = await requestAccessToken(tokenURL, {
42
41
  body: {
43
42
  grant_type: "authorization_code",
@@ -45,4 +45,4 @@ export interface OAuthBattledotnetConfig {
45
45
  */
46
46
  redirectURL?: string;
47
47
  }
48
- export declare function defineOAuthBattledotnetEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthBattledotnetConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
48
+ export declare function defineOAuthBattledotnetEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthBattledotnetConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
@@ -36,4 +36,4 @@ export interface OAuthCognitoConfig {
36
36
  */
37
37
  redirectURL?: string;
38
38
  }
39
- export declare function defineOAuthCognitoEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthCognitoConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
39
+ export declare function defineOAuthCognitoEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthCognitoConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
@@ -50,4 +50,4 @@ export interface OAuthDiscordConfig {
50
50
  */
51
51
  redirectURL?: string;
52
52
  }
53
- export declare function defineOAuthDiscordEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthDiscordConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
53
+ export declare function defineOAuthDiscordEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthDiscordConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
@@ -44,4 +44,4 @@ export interface OAuthDropboxConfig {
44
44
  */
45
45
  redirectURL?: string;
46
46
  }
47
- export declare function defineOAuthDropboxEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthDropboxConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
47
+ export declare function defineOAuthDropboxEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthDropboxConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
@@ -45,4 +45,4 @@ export interface OAuthFacebookConfig {
45
45
  */
46
46
  redirectURL?: string;
47
47
  }
48
- export declare function defineOAuthFacebookEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthFacebookConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
48
+ export declare function defineOAuthFacebookEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthFacebookConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
@@ -48,4 +48,4 @@ export interface OAuthGiteaConfig {
48
48
  */
49
49
  baseURL?: string;
50
50
  }
51
- export declare function defineOAuthGiteaEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthGiteaConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
51
+ export declare function defineOAuthGiteaEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthGiteaConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
@@ -93,5 +93,5 @@ interface GitHubTokens {
93
93
  export declare function defineOAuthGitHubEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthGitHubConfig, {
94
94
  user: GitHubUser;
95
95
  tokens: GitHubTokens;
96
- }>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
96
+ }>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
97
97
  export {};
@@ -49,4 +49,4 @@ export interface OAuthGitLabConfig {
49
49
  */
50
50
  baseURL?: string;
51
51
  }
52
- export declare function defineOAuthGitLabEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthGitLabConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
52
+ export declare function defineOAuthGitLabEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthGitLabConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
@@ -44,4 +44,4 @@ export interface OAuthGoogleConfig {
44
44
  */
45
45
  redirectURL?: string;
46
46
  }
47
- export declare function defineOAuthGoogleEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthGoogleConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
47
+ export declare function defineOAuthGoogleEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthGoogleConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
@@ -38,4 +38,4 @@ export interface OAuthHerokuConfig {
38
38
  */
39
39
  redirectURL?: string;
40
40
  }
41
- export declare function defineOAuthHerokuEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthHerokuConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
41
+ export declare function defineOAuthHerokuEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthHerokuConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
@@ -23,4 +23,4 @@ export interface OAuthHubspotConfig {
23
23
  */
24
24
  scope?: string[];
25
25
  }
26
- export declare function defineOAuthHubspotEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthHubspotConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
26
+ export declare function defineOAuthHubspotEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthHubspotConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
@@ -45,4 +45,4 @@ export interface OAuthInstagramConfig {
45
45
  */
46
46
  redirectURL?: string;
47
47
  }
48
- export declare function defineOAuthInstagramEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthInstagramConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
48
+ export declare function defineOAuthInstagramEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthInstagramConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
@@ -45,4 +45,4 @@ export interface OAuthKeycloakConfig {
45
45
  */
46
46
  redirectURL?: string;
47
47
  }
48
- export declare function defineOAuthKeycloakEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthKeycloakConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
48
+ export declare function defineOAuthKeycloakEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthKeycloakConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
@@ -35,4 +35,4 @@ export interface OAuthKickConfig {
35
35
  */
36
36
  redirectURL?: string;
37
37
  }
38
- export declare function defineOAuthKickEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthKickConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
38
+ export declare function defineOAuthKickEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthKickConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
@@ -42,4 +42,4 @@ export interface OAuthLineConfig {
42
42
  */
43
43
  redirectURL?: string;
44
44
  }
45
- export declare function defineOAuthLineEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthLineConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
45
+ export declare function defineOAuthLineEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthLineConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
@@ -38,4 +38,4 @@ export interface OAuthLinearConfig {
38
38
  */
39
39
  redirectURL?: string;
40
40
  }
41
- export declare function defineOAuthLinearEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthLinearConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
41
+ export declare function defineOAuthLinearEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthLinearConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
@@ -42,4 +42,4 @@ export interface OAuthLinkedInConfig {
42
42
  */
43
43
  redirectURL?: string;
44
44
  }
45
- export declare function defineOAuthLinkedInEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthLinkedInConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
45
+ export declare function defineOAuthLinkedInEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthLinkedInConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
@@ -60,8 +60,7 @@ export interface LiveChatConfig {
60
60
  */
61
61
  userURL?: string;
62
62
  /**
63
- * LiveChat OAuth Scope. accounts--my:ro is always applied to get user profile.
64
- * @default ['accounts--my:ro']
63
+ * LiveChat OAuth Scope. If not provided, the default scope from LiveChat will be used.
65
64
  * @example ['accounts--my:ro', 'chats--my:ro']
66
65
  */
67
66
  scope?: string[];
@@ -71,4 +70,4 @@ export interface LiveChatConfig {
71
70
  */
72
71
  authorizationParams?: Record<string, string>;
73
72
  }
74
- export declare function defineOAuthLiveChatEventHandler({ config, onSuccess, onError, }: OAuthConfig<LiveChatConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
73
+ export declare function defineOAuthLiveChatEventHandler({ config, onSuccess, onError, }: OAuthConfig<LiveChatConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
@@ -19,7 +19,6 @@ export function defineOAuthLiveChatEventHandler({
19
19
  authorizationURL: "https://accounts.livechat.com",
20
20
  tokenURL: "https://accounts.livechat.com/v2/token",
21
21
  userURL: "https://accounts.livechat.com/v2/accounts/me",
22
- scope: [],
23
22
  authorizationParams: {
24
23
  state: randomUUID()
25
24
  }
@@ -34,7 +33,6 @@ export function defineOAuthLiveChatEventHandler({
34
33
  }
35
34
  const query = getQuery(event);
36
35
  const redirectURL = config.redirectURL || getOAuthRedirectURL(event);
37
- const scope = [.../* @__PURE__ */ new Set([...config.scope, "accounts--my:ro"])].join(" ");
38
36
  if (!query.code) {
39
37
  return sendRedirect(
40
38
  event,
@@ -42,7 +40,7 @@ export function defineOAuthLiveChatEventHandler({
42
40
  client_id: config.clientId,
43
41
  redirect_uri: redirectURL,
44
42
  response_type: "code",
45
- scope,
43
+ scope: config.scope?.length ? config.scope.join(" ") : void 0,
46
44
  ...config.authorizationParams
47
45
  })
48
46
  );
@@ -51,4 +51,4 @@ export interface OAuthMicrosoftConfig {
51
51
  */
52
52
  redirectURL?: string;
53
53
  }
54
- export declare function defineOAuthMicrosoftEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthMicrosoftConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
54
+ export declare function defineOAuthMicrosoftEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthMicrosoftConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;