nuxt-auth-utils 0.2.1 → 0.3.1

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 (44) hide show
  1. package/README.md +40 -4
  2. package/dist/module.json +2 -2
  3. package/dist/module.mjs +1 -0
  4. package/dist/runtime/server/api/session.get.d.ts +1 -1
  5. package/dist/runtime/server/api/session.get.js +5 -3
  6. package/dist/runtime/server/lib/oauth/auth0.d.ts +1 -1
  7. package/dist/runtime/server/lib/oauth/auth0.js +3 -5
  8. package/dist/runtime/server/lib/oauth/battledotnet.d.ts +1 -1
  9. package/dist/runtime/server/lib/oauth/battledotnet.js +5 -9
  10. package/dist/runtime/server/lib/oauth/cognito.d.ts +1 -1
  11. package/dist/runtime/server/lib/oauth/cognito.js +3 -5
  12. package/dist/runtime/server/lib/oauth/discord.d.ts +1 -1
  13. package/dist/runtime/server/lib/oauth/discord.js +3 -5
  14. package/dist/runtime/server/lib/oauth/facebook.d.ts +1 -1
  15. package/dist/runtime/server/lib/oauth/facebook.js +4 -7
  16. package/dist/runtime/server/lib/oauth/github.d.ts +1 -1
  17. package/dist/runtime/server/lib/oauth/github.js +4 -7
  18. package/dist/runtime/server/lib/oauth/google.d.ts +1 -1
  19. package/dist/runtime/server/lib/oauth/google.js +3 -5
  20. package/dist/runtime/server/lib/oauth/keycloak.d.ts +1 -1
  21. package/dist/runtime/server/lib/oauth/keycloak.js +5 -9
  22. package/dist/runtime/server/lib/oauth/linkedin.d.ts +1 -1
  23. package/dist/runtime/server/lib/oauth/linkedin.js +3 -5
  24. package/dist/runtime/server/lib/oauth/microsoft.d.ts +1 -1
  25. package/dist/runtime/server/lib/oauth/microsoft.js +4 -7
  26. package/dist/runtime/server/lib/oauth/paypal.d.ts +1 -1
  27. package/dist/runtime/server/lib/oauth/paypal.js +4 -7
  28. package/dist/runtime/server/lib/oauth/spotify.d.ts +1 -1
  29. package/dist/runtime/server/lib/oauth/spotify.js +3 -5
  30. package/dist/runtime/server/lib/oauth/steam.d.ts +1 -1
  31. package/dist/runtime/server/lib/oauth/steam.js +3 -5
  32. package/dist/runtime/server/lib/oauth/twitch.d.ts +1 -1
  33. package/dist/runtime/server/lib/oauth/twitch.js +4 -7
  34. package/dist/runtime/server/lib/oauth/x.d.ts +1 -1
  35. package/dist/runtime/server/lib/oauth/x.js +4 -7
  36. package/dist/runtime/server/lib/oauth/xsuaa.d.ts +1 -1
  37. package/dist/runtime/server/lib/oauth/xsuaa.js +3 -5
  38. package/dist/runtime/server/lib/oauth/yandex.d.ts +1 -1
  39. package/dist/runtime/server/lib/oauth/yandex.js +3 -5
  40. package/dist/types.d.mts +1 -17
  41. package/dist/types.d.ts +1 -17
  42. package/package.json +15 -15
  43. package/dist/runtime/server/utils/oauth.d.ts +0 -36
  44. package/dist/runtime/server/utils/oauth.js +0 -36
package/README.md CHANGED
@@ -21,6 +21,8 @@ Add Authentication to Nuxt applications with secured & sealed cookies sessions.
21
21
  - [`<AuthState>` component](#authstate-component)
22
22
  - [Extendable with hooks](#extend-session)
23
23
 
24
+ It has few dependencies (only from [UnJS](https://github.com/unjs)), run on multiple JS environments (Node, Deno, Workers) and is fully typed with TypeScript.
25
+
24
26
  ## Requirements
25
27
 
26
28
  This module only works with a Nuxt server running as it uses server API routes (`nuxt build`).
@@ -56,7 +58,7 @@ Nuxt Auth Utils automatically adds some plugins to fetch the current user sessio
56
58
 
57
59
  ```vue
58
60
  <script setup>
59
- const { loggedIn, user, session, clear } = useUserSession()
61
+ const { loggedIn, user, session, fetch, clear } = useUserSession()
60
62
  </script>
61
63
 
62
64
  <template>
@@ -72,6 +74,37 @@ const { loggedIn, user, session, clear } = useUserSession()
72
74
  </template>
73
75
  ```
74
76
 
77
+ **TypeScript Signature:**
78
+
79
+ ```ts
80
+ interface UserSessionComposable {
81
+ /**
82
+ * Computed indicating if the auth session is ready
83
+ */
84
+ ready: ComputedRef<boolean>
85
+ /**
86
+ * Computed indicating if the user is logged in.
87
+ */
88
+ loggedIn: ComputedRef<boolean>
89
+ /**
90
+ * The user object if logged in, null otherwise.
91
+ */
92
+ user: ComputedRef<User | null>
93
+ /**
94
+ * The session object.
95
+ */
96
+ session: Ref<UserSession>
97
+ /**
98
+ * Fetch the user session from the server.
99
+ */
100
+ fetch: () => Promise<void>
101
+ /**
102
+ * Clear the user session and remove the session cookie.
103
+ */
104
+ clear: () => Promise<void>
105
+ }
106
+ ```
107
+
75
108
  ## Server Utils
76
109
 
77
110
  The following helpers are auto-imported in your `server/` directory.
@@ -122,9 +155,9 @@ export {}
122
155
 
123
156
  ### OAuth Event Handlers
124
157
 
125
- All helpers are exposed from the `oauth` global variable and can be used in your server routes or API routes.
158
+ All handlers can be auto-imported and used in your server routes or API routes.
126
159
 
127
- The pattern is `oauth.<provider>EventHandler({ onSuccess, config?, onError? })`, example: `oauth.githubEventHandler`.
160
+ The pattern is `oauth<Provider>EventHandler({ onSuccess, config?, onError? })`, example: `oauthGitHubEventHandler`.
128
161
 
129
162
  The helper returns an event handler that automatically redirects to the provider authorization page and then calls `onSuccess` or `onError` depending on the result.
130
163
 
@@ -134,6 +167,7 @@ The `config` can be defined directly from the `runtimeConfig` in your `nuxt.conf
134
167
  export default defineNuxtConfig({
135
168
  runtimeConfig: {
136
169
  oauth: {
170
+ // provider in lowercase (github, google, etc.)
137
171
  <provider>: {
138
172
  clientId: '...',
139
173
  clientSecret: '...'
@@ -148,6 +182,8 @@ It can also be set using environment variables:
148
182
  - `NUXT_OAUTH_<PROVIDER>_CLIENT_ID`
149
183
  - `NUXT_OAUTH_<PROVIDER>_CLIENT_SECRET`
150
184
 
185
+ > Provider is in uppercase (GITHUB, GOOGLE, etc.)
186
+
151
187
  #### Supported OAuth Providers
152
188
 
153
189
  - Auth0
@@ -175,7 +211,7 @@ You can add your favorite provider by creating a new file in [src/runtime/server
175
211
  Example: `~/server/routes/auth/github.get.ts`
176
212
 
177
213
  ```ts
178
- export default oauth.githubEventHandler({
214
+ export default oauthGitHubEventHandler({
179
215
  config: {
180
216
  emailRequired: true
181
217
  },
package/dist/module.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "auth-utils",
3
3
  "configKey": "auth",
4
- "version": "0.2.1",
4
+ "version": "0.3.1",
5
5
  "builder": {
6
- "@nuxt/module-builder": "0.7.1",
6
+ "@nuxt/module-builder": "0.8.1",
7
7
  "unbuild": "2.0.0"
8
8
  }
9
9
  }
package/dist/module.mjs CHANGED
@@ -19,6 +19,7 @@ const module = defineNuxtModule({
19
19
  addPlugin(resolver.resolve("./runtime/app/plugins/session.server"));
20
20
  addPlugin(resolver.resolve("./runtime/app/plugins/session.client"));
21
21
  addServerPlugin(resolver.resolve("./runtime/server/plugins/oauth"));
22
+ addServerImportsDir(resolver.resolve("./runtime/server/lib/oauth"));
22
23
  addServerImportsDir(resolver.resolve("./runtime/server/utils"));
23
24
  addServerHandler({
24
25
  handler: resolver.resolve("./runtime/server/api/session.delete"),
@@ -1,2 +1,2 @@
1
- declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<import("../../types").UserSessionRequired>>;
1
+ declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<import("#auth-utils").UserSession>>;
2
2
  export default _default;
@@ -1,7 +1,9 @@
1
1
  import { eventHandler } from "h3";
2
- import { requireUserSession, sessionHooks } from "../utils/session.js";
2
+ import { getUserSession, sessionHooks } from "../utils/session.js";
3
3
  export default eventHandler(async (event) => {
4
- const session = await requireUserSession(event);
5
- await sessionHooks.callHookParallel("fetch", session, event);
4
+ const session = await getUserSession(event);
5
+ if (session.user) {
6
+ await sessionHooks.callHookParallel("fetch", session, event);
7
+ }
6
8
  return session;
7
9
  });
@@ -52,4 +52,4 @@ export interface OAuthAuth0Config {
52
52
  */
53
53
  authorizationParams?: Record<string, string>;
54
54
  }
55
- export declare function auth0EventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthAuth0Config>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
55
+ export declare function oauthAuth0EventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthAuth0Config>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
@@ -2,7 +2,7 @@ import { eventHandler, createError, getQuery, getRequestURL, sendRedirect } from
2
2
  import { withQuery, parsePath } from "ufo";
3
3
  import { defu } from "defu";
4
4
  import { useRuntimeConfig } from "#imports";
5
- export function auth0EventHandler({ config, onSuccess, onError }) {
5
+ export function oauthAuth0EventHandler({ config, onSuccess, onError }) {
6
6
  return eventHandler(async (event) => {
7
7
  config = defu(config, useRuntimeConfig(event).oauth?.auth0, {
8
8
  authorizationParams: {}
@@ -13,8 +13,7 @@ export function auth0EventHandler({ config, onSuccess, onError }) {
13
13
  statusCode: 500,
14
14
  message: "Missing NUXT_OAUTH_AUTH0_CLIENT_ID or NUXT_OAUTH_AUTH0_CLIENT_SECRET or NUXT_OAUTH_AUTH0_DOMAIN env variables."
15
15
  });
16
- if (!onError)
17
- throw error;
16
+ if (!onError) throw error;
18
17
  return onError(event, error);
19
18
  }
20
19
  const authorizationURL = `https://${config.domain}/authorize`;
@@ -63,8 +62,7 @@ export function auth0EventHandler({ config, onSuccess, onError }) {
63
62
  message: `Auth0 login failed: ${tokens.error?.data?.error_description || "Unknown error"}`,
64
63
  data: tokens
65
64
  });
66
- if (!onError)
67
- throw error;
65
+ if (!onError) throw error;
68
66
  return onError(event, error);
69
67
  }
70
68
  const tokenType = tokens.token_type;
@@ -40,4 +40,4 @@ export interface OAuthBattledotnetConfig {
40
40
  */
41
41
  authorizationParams?: Record<string, string>;
42
42
  }
43
- export declare function battledotnetEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthBattledotnetConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
43
+ export declare function oauthBattledotnetEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthBattledotnetConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
@@ -3,7 +3,7 @@ import { eventHandler, createError, getQuery, getRequestURL, sendRedirect } from
3
3
  import { withQuery, parsePath } from "ufo";
4
4
  import { defu } from "defu";
5
5
  import { useRuntimeConfig } from "#imports";
6
- export function battledotnetEventHandler({ config, onSuccess, onError }) {
6
+ export function oauthBattledotnetEventHandler({ config, onSuccess, onError }) {
7
7
  return eventHandler(async (event) => {
8
8
  config = defu(config, useRuntimeConfig(event).oauth?.battledotnet, {
9
9
  authorizationURL: "https://oauth.battle.net/authorize",
@@ -18,8 +18,7 @@ export function battledotnetEventHandler({ config, onSuccess, onError }) {
18
18
  message: `Battle.net login failed: ${query.error || "Unknown error"}`,
19
19
  data: query
20
20
  });
21
- if (!onError)
22
- throw error;
21
+ if (!onError) throw error;
23
22
  return onError(event, error);
24
23
  }
25
24
  if (!config.clientId || !config.clientSecret) {
@@ -27,8 +26,7 @@ export function battledotnetEventHandler({ config, onSuccess, onError }) {
27
26
  statusCode: 500,
28
27
  message: "Missing NUXT_OAUTH_BATTLEDOTNET_CLIENT_ID or NUXT_OAUTH_BATTLEDOTNET_CLIENT_SECRET env variables."
29
28
  });
30
- if (!onError)
31
- throw error;
29
+ if (!onError) throw error;
32
30
  return onError(event, error);
33
31
  }
34
32
  if (!code) {
@@ -82,8 +80,7 @@ export function battledotnetEventHandler({ config, onSuccess, onError }) {
82
80
  message: `Battle.net login failed: ${tokens.error || "Unknown error"}`,
83
81
  data: tokens
84
82
  });
85
- if (!onError)
86
- throw error;
83
+ if (!onError) throw error;
87
84
  return onError(event, error);
88
85
  }
89
86
  const accessToken = tokens.access_token;
@@ -99,8 +96,7 @@ export function battledotnetEventHandler({ config, onSuccess, onError }) {
99
96
  message: "Could not get Battle.net user",
100
97
  data: tokens
101
98
  });
102
- if (!onError)
103
- throw error;
99
+ if (!onError) throw error;
104
100
  return onError(event, error);
105
101
  }
106
102
  return onSuccess(event, {
@@ -31,4 +31,4 @@ export interface OAuthCognitoConfig {
31
31
  */
32
32
  authorizationParams?: Record<string, string>;
33
33
  }
34
- export declare function cognitoEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthCognitoConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
34
+ export declare function oauthCognitoEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthCognitoConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
@@ -2,7 +2,7 @@ import { eventHandler, createError, getQuery, getRequestURL, sendRedirect } from
2
2
  import { withQuery, parsePath } from "ufo";
3
3
  import { defu } from "defu";
4
4
  import { useRuntimeConfig } from "#imports";
5
- export function cognitoEventHandler({ config, onSuccess, onError }) {
5
+ export function oauthCognitoEventHandler({ config, onSuccess, onError }) {
6
6
  return eventHandler(async (event) => {
7
7
  config = defu(config, useRuntimeConfig(event).oauth?.cognito, {
8
8
  authorizationParams: {}
@@ -13,8 +13,7 @@ export function cognitoEventHandler({ config, onSuccess, onError }) {
13
13
  statusCode: 500,
14
14
  message: "Missing NUXT_OAUTH_COGNITO_CLIENT_ID, NUXT_OAUTH_COGNITO_CLIENT_SECRET, NUXT_OAUTH_COGNITO_USER_POOL_ID, or NUXT_OAUTH_COGNITO_REGION env variables."
15
15
  });
16
- if (!onError)
17
- throw error;
16
+ if (!onError) throw error;
18
17
  return onError(event, error);
19
18
  }
20
19
  const authorizationURL = `https://${config.userPoolId}.auth.${config.region}.amazoncognito.com/oauth2/authorize`;
@@ -51,8 +50,7 @@ export function cognitoEventHandler({ config, onSuccess, onError }) {
51
50
  message: `Cognito login failed: ${tokens.error_description || "Unknown error"}`,
52
51
  data: tokens
53
52
  });
54
- if (!onError)
55
- throw error;
53
+ if (!onError) throw error;
56
54
  return onError(event, error);
57
55
  }
58
56
  const tokenType = tokens.token_type;
@@ -45,4 +45,4 @@ export interface OAuthDiscordConfig {
45
45
  */
46
46
  authorizationParams?: Record<string, string>;
47
47
  }
48
- export declare function discordEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthDiscordConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
48
+ export declare function oauthDiscordEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthDiscordConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
@@ -2,7 +2,7 @@ import { eventHandler, createError, getQuery, getRequestURL, sendRedirect } from
2
2
  import { withQuery, parseURL, stringifyParsedURL } from "ufo";
3
3
  import { defu } from "defu";
4
4
  import { useRuntimeConfig } from "#imports";
5
- export function discordEventHandler({ config, onSuccess, onError }) {
5
+ export function oauthDiscordEventHandler({ config, onSuccess, onError }) {
6
6
  return eventHandler(async (event) => {
7
7
  config = defu(config, useRuntimeConfig(event).oauth?.discord, {
8
8
  authorizationURL: "https://discord.com/oauth2/authorize",
@@ -16,8 +16,7 @@ export function discordEventHandler({ config, onSuccess, onError }) {
16
16
  statusCode: 500,
17
17
  message: "Missing NUXT_OAUTH_DISCORD_CLIENT_ID or NUXT_OAUTH_DISCORD_CLIENT_SECRET env variables."
18
18
  });
19
- if (!onError)
20
- throw error;
19
+ if (!onError) throw error;
21
20
  return onError(event, error);
22
21
  }
23
22
  const redirectUrl = getRequestURL(event).href;
@@ -66,8 +65,7 @@ export function discordEventHandler({ config, onSuccess, onError }) {
66
65
  message: `Discord login failed: ${tokens.error?.data?.error_description || "Unknown error"}`,
67
66
  data: tokens
68
67
  });
69
- if (!onError)
70
- throw error;
68
+ if (!onError) throw error;
71
69
  return onError(event, error);
72
70
  }
73
71
  const accessToken = tokens.access_token;
@@ -40,4 +40,4 @@ export interface OAuthFacebookConfig {
40
40
  */
41
41
  authorizationParams?: Record<string, string>;
42
42
  }
43
- export declare function facebookEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthFacebookConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
43
+ export declare function oauthFacebookEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthFacebookConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
@@ -8,7 +8,7 @@ import {
8
8
  import { withQuery } from "ufo";
9
9
  import { defu } from "defu";
10
10
  import { useRuntimeConfig } from "#imports";
11
- export function facebookEventHandler({
11
+ export function oauthFacebookEventHandler({
12
12
  config,
13
13
  onSuccess,
14
14
  onError
@@ -26,8 +26,7 @@ export function facebookEventHandler({
26
26
  message: `Facebook login failed: ${query.error || "Unknown error"}`,
27
27
  data: query
28
28
  });
29
- if (!onError)
30
- throw error;
29
+ if (!onError) throw error;
31
30
  return onError(event, error);
32
31
  }
33
32
  if (!config.clientId) {
@@ -35,8 +34,7 @@ export function facebookEventHandler({
35
34
  statusCode: 500,
36
35
  message: "Missing NUXT_OAUTH_FACEBOOK_CLIENT_ID or NUXT_OAUTH_FACEBOOK_CLIENT_SECRET env variables."
37
36
  });
38
- if (!onError)
39
- throw error;
37
+ if (!onError) throw error;
40
38
  return onError(event, error);
41
39
  }
42
40
  const redirectUrl = getRequestURL(event).href;
@@ -66,8 +64,7 @@ export function facebookEventHandler({
66
64
  message: `Facebook login failed: ${tokens.error || "Unknown error"}`,
67
65
  data: tokens
68
66
  });
69
- if (!onError)
70
- throw error;
67
+ if (!onError) throw error;
71
68
  return onError(event, error);
72
69
  }
73
70
  const accessToken = tokens.access_token;
@@ -39,4 +39,4 @@ export interface OAuthGitHubConfig {
39
39
  */
40
40
  authorizationParams?: Record<string, string>;
41
41
  }
42
- export declare function githubEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthGitHubConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
42
+ export declare function oauthGitHubEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthGitHubConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
@@ -2,7 +2,7 @@ import { eventHandler, createError, getQuery, getRequestURL, sendRedirect } from
2
2
  import { withQuery } from "ufo";
3
3
  import { defu } from "defu";
4
4
  import { useRuntimeConfig } from "#imports";
5
- export function githubEventHandler({ config, onSuccess, onError }) {
5
+ export function oauthGitHubEventHandler({ config, onSuccess, onError }) {
6
6
  return eventHandler(async (event) => {
7
7
  config = defu(config, useRuntimeConfig(event).oauth?.github, {
8
8
  authorizationURL: "https://github.com/login/oauth/authorize",
@@ -16,8 +16,7 @@ export function githubEventHandler({ config, onSuccess, onError }) {
16
16
  message: `GitHub login failed: ${query.error || "Unknown error"}`,
17
17
  data: query
18
18
  });
19
- if (!onError)
20
- throw error;
19
+ if (!onError) throw error;
21
20
  return onError(event, error);
22
21
  }
23
22
  if (!config.clientId || !config.clientSecret) {
@@ -25,8 +24,7 @@ export function githubEventHandler({ config, onSuccess, onError }) {
25
24
  statusCode: 500,
26
25
  message: "Missing NUXT_OAUTH_GITHUB_CLIENT_ID or NUXT_OAUTH_GITHUB_CLIENT_SECRET env variables."
27
26
  });
28
- if (!onError)
29
- throw error;
27
+ if (!onError) throw error;
30
28
  return onError(event, error);
31
29
  }
32
30
  if (!query.code) {
@@ -62,8 +60,7 @@ export function githubEventHandler({ config, onSuccess, onError }) {
62
60
  message: `GitHub login failed: ${tokens.error || "Unknown error"}`,
63
61
  data: tokens
64
62
  });
65
- if (!onError)
66
- throw error;
63
+ if (!onError) throw error;
67
64
  return onError(event, error);
68
65
  }
69
66
  const accessToken = tokens.access_token;
@@ -39,4 +39,4 @@ export interface OAuthGoogleConfig {
39
39
  */
40
40
  authorizationParams?: Record<string, string>;
41
41
  }
42
- export declare function googleEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthGoogleConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
42
+ export declare function oauthGoogleEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthGoogleConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
@@ -8,7 +8,7 @@ import {
8
8
  import { withQuery, parsePath } from "ufo";
9
9
  import { defu } from "defu";
10
10
  import { useRuntimeConfig } from "#imports";
11
- export function googleEventHandler({
11
+ export function oauthGoogleEventHandler({
12
12
  config,
13
13
  onSuccess,
14
14
  onError
@@ -26,8 +26,7 @@ export function googleEventHandler({
26
26
  statusCode: 500,
27
27
  message: "Missing NUXT_OAUTH_GOOGLE_CLIENT_ID env variables."
28
28
  });
29
- if (!onError)
30
- throw error;
29
+ if (!onError) throw error;
31
30
  return onError(event, error);
32
31
  }
33
32
  const redirectUrl = getRequestURL(event).href;
@@ -63,8 +62,7 @@ export function googleEventHandler({
63
62
  message: `Google login failed: ${tokens.error?.data?.error_description || "Unknown error"}`,
64
63
  data: tokens
65
64
  });
66
- if (!onError)
67
- throw error;
65
+ if (!onError) throw error;
68
66
  return onError(event, error);
69
67
  }
70
68
  const accessToken = tokens.access_token;
@@ -33,4 +33,4 @@ export interface OAuthKeycloakConfig {
33
33
  */
34
34
  authorizationParams?: Record<string, string>;
35
35
  }
36
- export declare function keycloakEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthKeycloakConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
36
+ export declare function oauthKeycloakEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthKeycloakConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
@@ -8,7 +8,7 @@ import {
8
8
  import { withQuery, parsePath } from "ufo";
9
9
  import { defu } from "defu";
10
10
  import { useRuntimeConfig } from "#imports";
11
- export function keycloakEventHandler({
11
+ export function oauthKeycloakEventHandler({
12
12
  config,
13
13
  onSuccess,
14
14
  onError
@@ -25,8 +25,7 @@ export function keycloakEventHandler({
25
25
  message: `Keycloak login failed: ${query.error || "Unknown error"}`,
26
26
  data: query
27
27
  });
28
- if (!onError)
29
- throw error;
28
+ if (!onError) throw error;
30
29
  return onError(event, error);
31
30
  }
32
31
  if (!config.clientId || !config.clientSecret || !config.serverUrl || !config.realm) {
@@ -34,8 +33,7 @@ export function keycloakEventHandler({
34
33
  statusCode: 500,
35
34
  message: "Missing NUXT_OAUTH_KEYCLOAK_CLIENT_ID or NUXT_OAUTH_KEYCLOAK_CLIENT_SECRET or NUXT_OAUTH_KEYCLOAK_SERVER_URL or NUXT_OAUTH_KEYCLOAK_REALM env variables."
36
35
  });
37
- if (!onError)
38
- throw error;
36
+ if (!onError) throw error;
39
37
  return onError(event, error);
40
38
  }
41
39
  const realmURL = `${config.serverUrl}/realms/${config.realm}`;
@@ -80,8 +78,7 @@ export function keycloakEventHandler({
80
78
  message: `Keycloak login failed: ${tokens.error?.data?.error_description || "Unknown error"}`,
81
79
  data: tokens
82
80
  });
83
- if (!onError)
84
- throw error;
81
+ if (!onError) throw error;
85
82
  return onError(event, error);
86
83
  }
87
84
  const accessToken = tokens.access_token;
@@ -100,8 +97,7 @@ export function keycloakEventHandler({
100
97
  message: "Could not get Keycloak user",
101
98
  data: tokens
102
99
  });
103
- if (!onError)
104
- throw error;
100
+ if (!onError) throw error;
105
101
  return onError(event, error);
106
102
  }
107
103
  return onSuccess(event, {
@@ -45,5 +45,5 @@ interface OAuthConfig {
45
45
  }) => Promise<void> | void;
46
46
  onError?: (event: H3Event, error: H3Error) => Promise<void> | void;
47
47
  }
48
- export declare function linkedinEventHandler({ config, onSuccess, onError }: OAuthConfig): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
48
+ export declare function oauthLinkedInEventHandler({ config, onSuccess, onError }: OAuthConfig): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
49
49
  export {};
@@ -2,7 +2,7 @@ import { eventHandler, createError, getQuery, getRequestURL, sendRedirect } from
2
2
  import { withQuery, parseURL, stringifyParsedURL } from "ufo";
3
3
  import { defu } from "defu";
4
4
  import { useRuntimeConfig } from "#imports";
5
- export function linkedinEventHandler({ config, onSuccess, onError }) {
5
+ export function oauthLinkedInEventHandler({ config, onSuccess, onError }) {
6
6
  return eventHandler(async (event) => {
7
7
  config = defu(config, useRuntimeConfig(event).oauth?.linkedin, {
8
8
  authorizationURL: "https://www.linkedin.com/oauth/v2/authorization",
@@ -15,8 +15,7 @@ export function linkedinEventHandler({ config, onSuccess, onError }) {
15
15
  statusCode: 500,
16
16
  message: "Missing NUXT_OAUTH_LINKEDIN_CLIENT_ID or NUXT_OAUTH_LINKEDIN_CLIENT_SECRET env variables."
17
17
  });
18
- if (!onError)
19
- throw error;
18
+ if (!onError) throw error;
20
19
  return onError(event, error);
21
20
  }
22
21
  const redirectUrl = getRequestURL(event).href;
@@ -65,8 +64,7 @@ export function linkedinEventHandler({ config, onSuccess, onError }) {
65
64
  message: `LinkedIn login failed: ${tokens.error?.data?.error_description || "Unknown error"}`,
66
65
  data: tokens
67
66
  });
68
- if (!onError)
69
- throw error;
67
+ if (!onError) throw error;
70
68
  return onError(event, error);
71
69
  }
72
70
  const accessToken = tokens.access_token;
@@ -59,5 +59,5 @@ interface OAuthConfig {
59
59
  }) => Promise<void> | void;
60
60
  onError?: (event: H3Event, error: H3Error) => Promise<void> | void;
61
61
  }
62
- export declare function microsoftEventHandler({ config, onSuccess, onError }: OAuthConfig): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
62
+ export declare function oauthMicrosoftEventHandler({ config, onSuccess, onError }: OAuthConfig): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
63
63
  export {};
@@ -2,7 +2,7 @@ import { eventHandler, createError, getQuery, getRequestURL, sendRedirect } from
2
2
  import { withQuery, parsePath } from "ufo";
3
3
  import { defu } from "defu";
4
4
  import { useRuntimeConfig } from "#imports";
5
- export function microsoftEventHandler({ config, onSuccess, onError }) {
5
+ export function oauthMicrosoftEventHandler({ config, onSuccess, onError }) {
6
6
  return eventHandler(async (event) => {
7
7
  config = defu(config, useRuntimeConfig(event).oauth?.microsoft, {
8
8
  authorizationParams: {}
@@ -13,8 +13,7 @@ export function microsoftEventHandler({ config, onSuccess, onError }) {
13
13
  statusCode: 500,
14
14
  message: "Missing NUXT_OAUTH_MICROSOFT_CLIENT_ID or NUXT_OAUTH_MICROSOFT_CLIENT_SECRET or NUXT_OAUTH_MICROSOFT_TENANT env variables."
15
15
  });
16
- if (!onError)
17
- throw error;
16
+ if (!onError) throw error;
18
17
  return onError(event, error);
19
18
  }
20
19
  const authorizationURL = config.authorizationURL || `https://login.microsoftonline.com/${config.tenant}/oauth2/v2.0/authorize`;
@@ -57,8 +56,7 @@ export function microsoftEventHandler({ config, onSuccess, onError }) {
57
56
  message: `Microsoft login failed: ${tokens.error?.data?.error_description || "Unknown error"}`,
58
57
  data: tokens
59
58
  });
60
- if (!onError)
61
- throw error;
59
+ if (!onError) throw error;
62
60
  return onError(event, error);
63
61
  }
64
62
  const tokenType = tokens.token_type;
@@ -77,8 +75,7 @@ export function microsoftEventHandler({ config, onSuccess, onError }) {
77
75
  message: `Microsoft login failed: ${user.error || "Unknown error"}`,
78
76
  data: user
79
77
  });
80
- if (!onError)
81
- throw error;
78
+ if (!onError) throw error;
82
79
  return onError(event, error);
83
80
  }
84
81
  return onSuccess(event, {
@@ -44,4 +44,4 @@ export interface OAuthPaypalConfig {
44
44
  */
45
45
  authorizationParams?: Record<string, string>;
46
46
  }
47
- export declare function paypalEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthPaypalConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
47
+ export declare function oauthPaypalEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthPaypalConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
@@ -2,7 +2,7 @@ import { eventHandler, createError, getQuery, getRequestURL, sendRedirect } from
2
2
  import { withQuery, parsePath } from "ufo";
3
3
  import { defu } from "defu";
4
4
  import { useRuntimeConfig } from "#imports";
5
- export function paypalEventHandler({ config, onSuccess, onError }) {
5
+ export function oauthPaypalEventHandler({ config, onSuccess, onError }) {
6
6
  return eventHandler(async (event) => {
7
7
  config = defu(config, useRuntimeConfig(event).oauth?.paypal, {
8
8
  sandbox: import.meta.dev,
@@ -16,8 +16,7 @@ export function paypalEventHandler({ config, onSuccess, onError }) {
16
16
  statusCode: 500,
17
17
  message: "Missing NUXT_OAUTH_PAYPAL_CLIENT_ID env variables."
18
18
  });
19
- if (!onError)
20
- throw error;
19
+ if (!onError) throw error;
21
20
  return onError(event, error);
22
21
  }
23
22
  let paypalAPI = "api-m.paypal.com";
@@ -71,8 +70,7 @@ export function paypalEventHandler({ config, onSuccess, onError }) {
71
70
  message: `PayPal login failed: ${tokens.error?.data?.error_description || "Unknown error"}`,
72
71
  data: tokens
73
72
  });
74
- if (!onError)
75
- throw error;
73
+ if (!onError) throw error;
76
74
  return onError(event, error);
77
75
  }
78
76
  const accessToken = tokens.access_token;
@@ -92,8 +90,7 @@ export function paypalEventHandler({ config, onSuccess, onError }) {
92
90
  message: "Could not get PayPal user",
93
91
  data: tokens
94
92
  });
95
- if (!onError)
96
- throw error;
93
+ if (!onError) throw error;
97
94
  return onError(event, error);
98
95
  }
99
96
  return onSuccess(event, {
@@ -39,4 +39,4 @@ export interface OAuthSpotifyConfig {
39
39
  */
40
40
  authorizationParams?: Record<string, string>;
41
41
  }
42
- export declare function spotifyEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthSpotifyConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
42
+ export declare function oauthSpotifyEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthSpotifyConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
@@ -2,7 +2,7 @@ import { eventHandler, createError, getQuery, getRequestURL, sendRedirect } from
2
2
  import { withQuery, parsePath } from "ufo";
3
3
  import { defu } from "defu";
4
4
  import { useRuntimeConfig } from "#imports";
5
- export function spotifyEventHandler({ config, onSuccess, onError }) {
5
+ export function oauthSpotifyEventHandler({ config, onSuccess, onError }) {
6
6
  return eventHandler(async (event) => {
7
7
  config = defu(config, useRuntimeConfig(event).oauth?.spotify, {
8
8
  authorizationURL: "https://accounts.spotify.com/authorize",
@@ -15,8 +15,7 @@ export function spotifyEventHandler({ config, onSuccess, onError }) {
15
15
  statusCode: 500,
16
16
  message: "Missing NUXT_OAUTH_SPOTIFY_CLIENT_ID or NUXT_OAUTH_SPOTIFY_CLIENT_SECRET env variables."
17
17
  });
18
- if (!onError)
19
- throw error;
18
+ if (!onError) throw error;
20
19
  return onError(event, error);
21
20
  }
22
21
  const redirectUrl = getRequestURL(event).href;
@@ -60,8 +59,7 @@ export function spotifyEventHandler({ config, onSuccess, onError }) {
60
59
  message: `Spotify login failed: ${tokens.error?.data?.error_description || "Unknown error"}`,
61
60
  data: tokens
62
61
  });
63
- if (!onError)
64
- throw error;
62
+ if (!onError) throw error;
65
63
  return onError(event, error);
66
64
  }
67
65
  const accessToken = tokens.access_token;
@@ -12,4 +12,4 @@ export interface OAuthSteamConfig {
12
12
  */
13
13
  authorizationURL?: string;
14
14
  }
15
- export declare function steamEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthSteamConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
15
+ export declare function oauthSteamEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthSteamConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
@@ -2,7 +2,7 @@ import { eventHandler, createError, getQuery, getRequestURL, sendRedirect } from
2
2
  import { withQuery } from "ufo";
3
3
  import { defu } from "defu";
4
4
  import { useRuntimeConfig } from "#imports";
5
- export function steamEventHandler({ config, onSuccess, onError }) {
5
+ export function oauthSteamEventHandler({ config, onSuccess, onError }) {
6
6
  return eventHandler(async (event) => {
7
7
  config = defu(config, useRuntimeConfig(event).oauth?.steam, {
8
8
  authorizationURL: "https://steamcommunity.com/openid/login"
@@ -13,8 +13,7 @@ export function steamEventHandler({ config, onSuccess, onError }) {
13
13
  statusCode: 500,
14
14
  message: "Missing NUXT_OAUTH_STEAM_API_KEY env variable."
15
15
  });
16
- if (!onError)
17
- throw error;
16
+ if (!onError) throw error;
18
17
  return onError(event, error);
19
18
  }
20
19
  if (!query["openid.claimed_id"]) {
@@ -37,8 +36,7 @@ export function steamEventHandler({ config, onSuccess, onError }) {
37
36
  statusCode: 401,
38
37
  message: "Steam login failed: Unknown error"
39
38
  });
40
- if (!onError)
41
- throw error;
39
+ if (!onError) throw error;
42
40
  return onError(event, error);
43
41
  }
44
42
  const steamId = query["openid.claimed_id"].split("/").pop();
@@ -39,4 +39,4 @@ export interface OAuthTwitchConfig {
39
39
  */
40
40
  authorizationParams?: Record<string, string>;
41
41
  }
42
- export declare function twitchEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthTwitchConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
42
+ export declare function oauthTwitchEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthTwitchConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
@@ -2,7 +2,7 @@ import { eventHandler, createError, getQuery, getRequestURL, sendRedirect } from
2
2
  import { withQuery, parsePath } from "ufo";
3
3
  import { defu } from "defu";
4
4
  import { useRuntimeConfig } from "#imports";
5
- export function twitchEventHandler({ config, onSuccess, onError }) {
5
+ export function oauthTwitchEventHandler({ config, onSuccess, onError }) {
6
6
  return eventHandler(async (event) => {
7
7
  config = defu(config, useRuntimeConfig(event).oauth?.twitch, {
8
8
  authorizationURL: "https://id.twitch.tv/oauth2/authorize",
@@ -15,8 +15,7 @@ export function twitchEventHandler({ config, onSuccess, onError }) {
15
15
  statusCode: 500,
16
16
  message: "Missing NUXT_OAUTH_TWITCH_CLIENT_ID env variables."
17
17
  });
18
- if (!onError)
19
- throw error;
18
+ if (!onError) throw error;
20
19
  return onError(event, error);
21
20
  }
22
21
  const redirectUrl = getRequestURL(event).href;
@@ -60,8 +59,7 @@ export function twitchEventHandler({ config, onSuccess, onError }) {
60
59
  message: `Twitch login failed: ${tokens.error?.data?.error_description || "Unknown error"}`,
61
60
  data: tokens
62
61
  });
63
- if (!onError)
64
- throw error;
62
+ if (!onError) throw error;
65
63
  return onError(event, error);
66
64
  }
67
65
  const accessToken = tokens.access_token;
@@ -78,8 +76,7 @@ export function twitchEventHandler({ config, onSuccess, onError }) {
78
76
  message: "Could not get Twitch user",
79
77
  data: tokens
80
78
  });
81
- if (!onError)
82
- throw error;
79
+ if (!onError) throw error;
83
80
  return onError(event, error);
84
81
  }
85
82
  return onSuccess(event, {
@@ -43,4 +43,4 @@ export interface OAuthXConfig {
43
43
  */
44
44
  authorizationParams: Record<string, string>;
45
45
  }
46
- export declare function xEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthXConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
46
+ export declare function oauthXEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthXConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
@@ -9,7 +9,7 @@ import {
9
9
  import { withQuery, parsePath } from "ufo";
10
10
  import { defu } from "defu";
11
11
  import { useRuntimeConfig } from "#imports";
12
- export function xEventHandler({
12
+ export function oauthXEventHandler({
13
13
  config,
14
14
  onSuccess,
15
15
  onError
@@ -30,8 +30,7 @@ export function xEventHandler({
30
30
  statusCode: 500,
31
31
  message: "Missing NUXT_OAUTH_X_CLIENT_ID env variables."
32
32
  });
33
- if (!onError)
34
- throw error;
33
+ if (!onError) throw error;
35
34
  return onError(event, error);
36
35
  }
37
36
  const redirectUrl = getRequestURL(event).href;
@@ -72,8 +71,7 @@ export function xEventHandler({
72
71
  message: `X login failed: ${tokens.error?.data?.error_description || "Unknown error"}`,
73
72
  data: tokens
74
73
  });
75
- if (!onError)
76
- throw error;
74
+ if (!onError) throw error;
77
75
  return onError(event, error);
78
76
  }
79
77
  const accessToken = tokens.access_token;
@@ -109,8 +107,7 @@ export function xEventHandler({
109
107
  statusCode: 401,
110
108
  message: "Twitter login failed: no user email found"
111
109
  });
112
- if (!onError)
113
- throw error;
110
+ if (!onError) throw error;
114
111
  return onError(event, error);
115
112
  }
116
113
  }
@@ -23,4 +23,4 @@ export interface OAuthXSUAAConfig {
23
23
  */
24
24
  scope?: string[];
25
25
  }
26
- export declare function xsuaaEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthXSUAAConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
26
+ export declare function oauthXSUAAEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthXSUAAConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
@@ -2,7 +2,7 @@ import { eventHandler, createError, getQuery, getRequestURL, sendRedirect } from
2
2
  import { withQuery, parsePath } from "ufo";
3
3
  import { defu } from "defu";
4
4
  import { useRuntimeConfig } from "#imports";
5
- export function xsuaaEventHandler({ config, onSuccess, onError }) {
5
+ export function oauthXSUAAEventHandler({ config, onSuccess, onError }) {
6
6
  return eventHandler(async (event) => {
7
7
  config = defu(config, useRuntimeConfig(event).oauth?.xsuaa);
8
8
  const { code } = getQuery(event);
@@ -11,8 +11,7 @@ export function xsuaaEventHandler({ config, onSuccess, onError }) {
11
11
  statusCode: 500,
12
12
  message: "Missing NUXT_OAUTH_XSUAA_CLIENT_ID or NUXT_OAUTH_XSUAA_CLIENT_SECRET or NUXT_OAUTH_XSUAA_DOMAIN env variables."
13
13
  });
14
- if (!onError)
15
- throw error;
14
+ if (!onError) throw error;
16
15
  return onError(event, error);
17
16
  }
18
17
  const authorizationURL = `https://${config.domain}/oauth/authorize`;
@@ -54,8 +53,7 @@ export function xsuaaEventHandler({ config, onSuccess, onError }) {
54
53
  message: `XSUAA login failed: ${tokens.error?.data?.error_description || "Unknown error"}`,
55
54
  data: tokens
56
55
  });
57
- if (!onError)
58
- throw error;
56
+ if (!onError) throw error;
59
57
  return onError(event, error);
60
58
  }
61
59
  const tokenType = tokens.token_type;
@@ -38,4 +38,4 @@ export interface OAuthYandexConfig {
38
38
  */
39
39
  userURL?: string;
40
40
  }
41
- export declare function yandexEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthYandexConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
41
+ export declare function oauthYandexEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthYandexConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
@@ -8,7 +8,7 @@ import {
8
8
  import { withQuery, parseURL, stringifyParsedURL } from "ufo";
9
9
  import { defu } from "defu";
10
10
  import { useRuntimeConfig } from "#imports";
11
- export function yandexEventHandler({
11
+ export function oauthYandexEventHandler({
12
12
  config,
13
13
  onSuccess,
14
14
  onError
@@ -25,8 +25,7 @@ export function yandexEventHandler({
25
25
  statusCode: 500,
26
26
  message: "Missing NUXT_OAUTH_YANDEX_CLIENT_ID or NUXT_OAUTH_YANDEX_CLIENT_SECRET env variables."
27
27
  });
28
- if (!onError)
29
- throw error;
28
+ if (!onError) throw error;
30
29
  return onError(event, error);
31
30
  }
32
31
  const redirectUrl = getRequestURL(event).href;
@@ -66,8 +65,7 @@ export function yandexEventHandler({
66
65
  message: `Yandex login failed: ${tokens.error?.data?.error_description || "Unknown error"}`,
67
66
  data: tokens
68
67
  });
69
- if (!onError)
70
- throw error;
68
+ if (!onError) throw error;
71
69
  return onError(event, error);
72
70
  }
73
71
  const accessToken = tokens.access_token;
package/dist/types.d.mts CHANGED
@@ -1,17 +1 @@
1
-
2
- import type { ModuleOptions } from './module.js'
3
-
4
-
5
-
6
- declare module '@nuxt/schema' {
7
- interface NuxtConfig { ['auth']?: Partial<ModuleOptions> }
8
- interface NuxtOptions { ['auth']?: ModuleOptions }
9
- }
10
-
11
- declare module 'nuxt/schema' {
12
- interface NuxtConfig { ['auth']?: Partial<ModuleOptions> }
13
- interface NuxtOptions { ['auth']?: ModuleOptions }
14
- }
15
-
16
-
17
- export type { ModuleOptions, default } from './module.js'
1
+ export { type ModuleOptions, default } from './module.js'
package/dist/types.d.ts CHANGED
@@ -1,17 +1 @@
1
-
2
- import type { ModuleOptions } from './module'
3
-
4
-
5
-
6
- declare module '@nuxt/schema' {
7
- interface NuxtConfig { ['auth']?: Partial<ModuleOptions> }
8
- interface NuxtOptions { ['auth']?: ModuleOptions }
9
- }
10
-
11
- declare module 'nuxt/schema' {
12
- interface NuxtConfig { ['auth']?: Partial<ModuleOptions> }
13
- interface NuxtOptions { ['auth']?: ModuleOptions }
14
- }
15
-
16
-
17
- export type { ModuleOptions, default } from './module'
1
+ export { type ModuleOptions, default } from './module'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-auth-utils",
3
- "version": "0.2.1",
3
+ "version": "0.3.1",
4
4
  "description": "Minimalist Auth module for Nuxt with SSR",
5
5
  "repository": "Atinux/nuxt-auth-utils",
6
6
  "license": "MIT",
@@ -32,7 +32,7 @@
32
32
  "test:watch": "vitest watch"
33
33
  },
34
34
  "dependencies": {
35
- "@nuxt/kit": "^3.12.2",
35
+ "@nuxt/kit": "^3.12.4",
36
36
  "defu": "^6.1.4",
37
37
  "hookable": "^5.5.3",
38
38
  "ofetch": "^1.3.4",
@@ -41,20 +41,20 @@
41
41
  "uncrypto": "^0.1.3"
42
42
  },
43
43
  "devDependencies": {
44
- "@iconify-json/simple-icons": "^1.1.106",
44
+ "@iconify-json/simple-icons": "^1.1.111",
45
45
  "@nuxt/devtools": "latest",
46
- "@nuxt/eslint-config": "^0.3.13",
47
- "@nuxt/module-builder": "^0.7.1",
48
- "@nuxt/schema": "^3.12.2",
49
- "@nuxt/test-utils": "^3.13.1",
50
- "@nuxt/ui": "^2.17.0",
51
- "@nuxt/ui-pro": "^1.3.0",
52
- "@types/node": "^20.14.4",
46
+ "@nuxt/eslint-config": "^0.4.0",
47
+ "@nuxt/module-builder": "^0.8.1",
48
+ "@nuxt/schema": "^3.12.4",
49
+ "@nuxt/test-utils": "^3.14.0",
50
+ "@nuxt/ui": "^2.18.2",
51
+ "@nuxt/ui-pro": "^1.3.1",
52
+ "@types/node": "^22.0.0",
53
53
  "changelogen": "^0.5.5",
54
- "eslint": "^9.5.0",
55
- "nuxt": "^3.12.2",
56
- "typescript": "^5.4.5",
57
- "vitest": "^1.6.0",
58
- "vue-tsc": "^2.0.21"
54
+ "eslint": "^9.8.0",
55
+ "nuxt": "^3.12.4",
56
+ "typescript": "^5.5.4",
57
+ "vitest": "^2.0.4",
58
+ "vue-tsc": "^2.0.29"
59
59
  }
60
60
  }
@@ -1,36 +0,0 @@
1
- import { githubEventHandler } from '../lib/oauth/github.js';
2
- import { googleEventHandler } from '../lib/oauth/google.js';
3
- import { spotifyEventHandler } from '../lib/oauth/spotify.js';
4
- import { twitchEventHandler } from '../lib/oauth/twitch.js';
5
- import { auth0EventHandler } from '../lib/oauth/auth0.js';
6
- import { microsoftEventHandler } from '../lib/oauth/microsoft.js';
7
- import { discordEventHandler } from '../lib/oauth/discord.js';
8
- import { battledotnetEventHandler } from '../lib/oauth/battledotnet.js';
9
- import { keycloakEventHandler } from '../lib/oauth/keycloak.js';
10
- import { linkedinEventHandler } from '../lib/oauth/linkedin.js';
11
- import { cognitoEventHandler } from '../lib/oauth/cognito.js';
12
- import { facebookEventHandler } from '../lib/oauth/facebook.js';
13
- import { paypalEventHandler } from '../lib/oauth/paypal.js';
14
- import { steamEventHandler } from '../lib/oauth/steam.js';
15
- import { xEventHandler } from '../lib/oauth/x.js';
16
- import { xsuaaEventHandler } from '../lib/oauth/xsuaa.js';
17
- import { yandexEventHandler } from '../lib/oauth/yandex.js';
18
- export declare const oauth: {
19
- githubEventHandler: typeof githubEventHandler;
20
- spotifyEventHandler: typeof spotifyEventHandler;
21
- googleEventHandler: typeof googleEventHandler;
22
- twitchEventHandler: typeof twitchEventHandler;
23
- auth0EventHandler: typeof auth0EventHandler;
24
- microsoftEventHandler: typeof microsoftEventHandler;
25
- discordEventHandler: typeof discordEventHandler;
26
- battledotnetEventHandler: typeof battledotnetEventHandler;
27
- keycloakEventHandler: typeof keycloakEventHandler;
28
- linkedinEventHandler: typeof linkedinEventHandler;
29
- cognitoEventHandler: typeof cognitoEventHandler;
30
- facebookEventHandler: typeof facebookEventHandler;
31
- paypalEventHandler: typeof paypalEventHandler;
32
- steamEventHandler: typeof steamEventHandler;
33
- xEventHandler: typeof xEventHandler;
34
- xsuaaEventHandler: typeof xsuaaEventHandler;
35
- yandexEventHandler: typeof yandexEventHandler;
36
- };
@@ -1,36 +0,0 @@
1
- import { githubEventHandler } from "../lib/oauth/github.js";
2
- import { googleEventHandler } from "../lib/oauth/google.js";
3
- import { spotifyEventHandler } from "../lib/oauth/spotify.js";
4
- import { twitchEventHandler } from "../lib/oauth/twitch.js";
5
- import { auth0EventHandler } from "../lib/oauth/auth0.js";
6
- import { microsoftEventHandler } from "../lib/oauth/microsoft.js";
7
- import { discordEventHandler } from "../lib/oauth/discord.js";
8
- import { battledotnetEventHandler } from "../lib/oauth/battledotnet.js";
9
- import { keycloakEventHandler } from "../lib/oauth/keycloak.js";
10
- import { linkedinEventHandler } from "../lib/oauth/linkedin.js";
11
- import { cognitoEventHandler } from "../lib/oauth/cognito.js";
12
- import { facebookEventHandler } from "../lib/oauth/facebook.js";
13
- import { paypalEventHandler } from "../lib/oauth/paypal.js";
14
- import { steamEventHandler } from "../lib/oauth/steam.js";
15
- import { xEventHandler } from "../lib/oauth/x.js";
16
- import { xsuaaEventHandler } from "../lib/oauth/xsuaa.js";
17
- import { yandexEventHandler } from "../lib/oauth/yandex.js";
18
- export const oauth = {
19
- githubEventHandler,
20
- spotifyEventHandler,
21
- googleEventHandler,
22
- twitchEventHandler,
23
- auth0EventHandler,
24
- microsoftEventHandler,
25
- discordEventHandler,
26
- battledotnetEventHandler,
27
- keycloakEventHandler,
28
- linkedinEventHandler,
29
- cognitoEventHandler,
30
- facebookEventHandler,
31
- paypalEventHandler,
32
- steamEventHandler,
33
- xEventHandler,
34
- xsuaaEventHandler,
35
- yandexEventHandler
36
- };