nuxt-bearer-auth 0.1.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.
Files changed (59) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +265 -0
  3. package/dist/module.cjs +5 -0
  4. package/dist/module.d.mts +134 -0
  5. package/dist/module.d.ts +134 -0
  6. package/dist/module.json +12 -0
  7. package/dist/module.mjs +222 -0
  8. package/dist/runtime/composables/useBearerAuth.d.ts +34 -0
  9. package/dist/runtime/composables/useBearerAuth.js +259 -0
  10. package/dist/runtime/middleware/bearer-auth.global.d.ts +3 -0
  11. package/dist/runtime/middleware/bearer-auth.global.js +28 -0
  12. package/dist/runtime/plugins/bearer-auth.server.d.ts +3 -0
  13. package/dist/runtime/plugins/bearer-auth.server.js +26 -0
  14. package/dist/runtime/server/api/auth/forgot-password.post.d.ts +3 -0
  15. package/dist/runtime/server/api/auth/forgot-password.post.js +16 -0
  16. package/dist/runtime/server/api/auth/login.post.d.ts +15 -0
  17. package/dist/runtime/server/api/auth/login.post.js +54 -0
  18. package/dist/runtime/server/api/auth/logout.post.d.ts +6 -0
  19. package/dist/runtime/server/api/auth/logout.post.js +20 -0
  20. package/dist/runtime/server/api/auth/me.get.d.ts +5 -0
  21. package/dist/runtime/server/api/auth/me.get.js +37 -0
  22. package/dist/runtime/server/api/auth/otp-verification.post.d.ts +8 -0
  23. package/dist/runtime/server/api/auth/otp-verification.post.js +38 -0
  24. package/dist/runtime/server/api/auth/refresh.post.d.ts +7 -0
  25. package/dist/runtime/server/api/auth/refresh.post.js +37 -0
  26. package/dist/runtime/server/api/auth/register.post.d.ts +8 -0
  27. package/dist/runtime/server/api/auth/register.post.js +32 -0
  28. package/dist/runtime/server/api/auth/resend-otp/[identifier].post.d.ts +3 -0
  29. package/dist/runtime/server/api/auth/resend-otp/[identifier].post.js +21 -0
  30. package/dist/runtime/server/api/auth/reset-password.post.d.ts +3 -0
  31. package/dist/runtime/server/api/auth/reset-password.post.js +16 -0
  32. package/dist/runtime/server/api/auth/sessions/[id].delete.d.ts +6 -0
  33. package/dist/runtime/server/api/auth/sessions/[id].delete.js +20 -0
  34. package/dist/runtime/server/api/auth/sessions.get.d.ts +5 -0
  35. package/dist/runtime/server/api/auth/sessions.get.js +11 -0
  36. package/dist/runtime/server/api/auth/social-login.post.d.ts +7 -0
  37. package/dist/runtime/server/api/auth/social-login.post.js +41 -0
  38. package/dist/runtime/server/middleware/auth.d.ts +3 -0
  39. package/dist/runtime/server/middleware/auth.js +29 -0
  40. package/dist/runtime/server/plugins/redis.d.ts +3 -0
  41. package/dist/runtime/server/plugins/redis.js +23 -0
  42. package/dist/runtime/server/utils/config.d.ts +16 -0
  43. package/dist/runtime/server/utils/config.js +24 -0
  44. package/dist/runtime/server/utils/errors.d.ts +2 -0
  45. package/dist/runtime/server/utils/errors.js +20 -0
  46. package/dist/runtime/server/utils/external-api.d.ts +15 -0
  47. package/dist/runtime/server/utils/external-api.js +31 -0
  48. package/dist/runtime/server/utils/normalize.d.ts +16 -0
  49. package/dist/runtime/server/utils/normalize.js +30 -0
  50. package/dist/runtime/server/utils/paths.d.ts +4 -0
  51. package/dist/runtime/server/utils/paths.js +23 -0
  52. package/dist/runtime/server/utils/sessions.d.ts +4645 -0
  53. package/dist/runtime/server/utils/sessions.js +207 -0
  54. package/dist/runtime/types/auth.d.ts +49 -0
  55. package/dist/runtime/types/auth.js +0 -0
  56. package/dist/runtime/types/h3.d.ts +7 -0
  57. package/dist/types.d.mts +7 -0
  58. package/dist/types.d.ts +7 -0
  59. package/package.json +58 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Enoch Tetteh
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,265 @@
1
+ # Nuxt Bearer Auth
2
+
3
+ Reusable Nuxt authentication for APIs that issue bearer tokens. It is designed for Laravel-style auth responses by default, but it is not Laravel-specific: any backend that returns a bearer token and a user object can work through response path mapping.
4
+
5
+ ## Features
6
+
7
+ - Nuxt module install experience
8
+ - Redis-backed server sessions
9
+ - Secure HTTP-only session cookie
10
+ - `nuxt-csurf` integration
11
+ - Generic bearer-token API adapter
12
+ - Email/Mobile and password login
13
+ - Social login
14
+ - Registration
15
+ - OTP verification and resend
16
+ - Forgot/reset password
17
+ - `/me` session hydration
18
+ - Token refresh route
19
+ - Logout
20
+ - Active session listing
21
+ - Session revocation
22
+ - SSR auth hydration
23
+ - Global route middleware
24
+ - `useBearerAuth()` composable
25
+ - `useAuth()` alias for convenience
26
+
27
+ ## Install
28
+
29
+ ```bash
30
+ npm install nuxt-bearer-auth redis nuxt-csurf
31
+ ```
32
+
33
+ ```ts
34
+ export default defineNuxtConfig({
35
+ modules: ["nuxt-bearer-auth"],
36
+
37
+ bearerAuth: {
38
+ apiBaseUrl: process.env.API_BASE_URL,
39
+ redisUrl: process.env.REDIS_URL,
40
+
41
+ redirects: {
42
+ login: "/login",
43
+ authenticated: "/dashboard",
44
+ logout: "/",
45
+ unauthorized: "/auth/not-allowed",
46
+ },
47
+
48
+ routes: {
49
+ public: ["/", "/login", "/forgot-password", "/reset-password"],
50
+ authPages: ["/login", "/forgot-password", "/reset-password"],
51
+ },
52
+ },
53
+ });
54
+ ```
55
+
56
+ ## Environment
57
+
58
+ ```bash
59
+ API_BASE_URL=https://api.example.com
60
+ REDIS_URL=redis://127.0.0.1:6379
61
+ APP_ENV=local
62
+ ```
63
+
64
+ ## Default Backend Endpoints
65
+
66
+ The module exposes local Nuxt endpoints under `/api/auth/*` and proxies them to your backend.
67
+
68
+ | Local endpoint | Backend endpoint |
69
+ | --------------------------------------- | ----------------------------- |
70
+ | `POST /api/auth/login` | `auth/login` |
71
+ | `POST /api/auth/social-login` | `auth/social-login` |
72
+ | `POST /api/auth/logout` | `auth/logout` |
73
+ | `GET /api/auth/me` | `auth/account/me` |
74
+ | `POST /api/auth/refresh` | `auth/refresh` |
75
+ | `POST /api/auth/forgot-password` | `auth/forgot-password` |
76
+ | `POST /api/auth/reset-password` | `auth/reset-password` |
77
+ | `POST /api/auth/otp-verification` | `auth/verify-otp` |
78
+ | `POST /api/auth/resend-otp/:identifier` | `auth/resend-otp/:identifier` |
79
+ | `POST /api/auth/register` | `auth/register` |
80
+
81
+ Override any endpoint:
82
+
83
+ ```ts
84
+ export default defineNuxtConfig({
85
+ bearerAuth: {
86
+ endpoints: {
87
+ login: "v1/session",
88
+ me: "v1/me",
89
+ socialLogin: "v1/oauth/login",
90
+ },
91
+ },
92
+ });
93
+ ```
94
+
95
+ ## Backend Response Shape
96
+
97
+ The default response parser supports common bearer-token responses:
98
+
99
+ ```json
100
+ {
101
+ "success": true,
102
+ "message": "Login successful",
103
+ "data": {
104
+ "token": "plain-bearer-token",
105
+ "refresh_token": "optional-refresh-token",
106
+ "user": {
107
+ "id": 1,
108
+ "email": "person@example.com"
109
+ }
110
+ }
111
+ }
112
+ ```
113
+
114
+ It also checks top-level fallbacks like `token`, `access_token`, and `user`.
115
+
116
+ For a different API shape, map paths:
117
+
118
+ ```ts
119
+ export default defineNuxtConfig({
120
+ bearerAuth: {
121
+ responsePaths: {
122
+ token: ["auth.accessToken"],
123
+ refreshToken: ["auth.refreshToken"],
124
+ user: ["account"],
125
+ userId: ["id"],
126
+ message: ["message"],
127
+ success: ["ok"],
128
+ },
129
+ },
130
+ });
131
+ ```
132
+
133
+ ## Social Login
134
+
135
+ On the client:
136
+
137
+ ```ts
138
+ const auth = useBearerAuth();
139
+
140
+ await auth.socialLogin({
141
+ provider: "google",
142
+ jwt: googleCredential,
143
+ });
144
+ ```
145
+
146
+ Your backend should validate the provider token and return the same bearer-token response shape as normal login.
147
+
148
+ ## Client Usage
149
+
150
+ ```vue
151
+ <script setup lang="ts">
152
+ const auth = useBearerAuth();
153
+
154
+ async function submit() {
155
+ await auth.login({
156
+ identifier: "person@example.com",
157
+ password: "secret",
158
+ });
159
+ }
160
+ </script>
161
+ ```
162
+
163
+ `identifier` could be any string that identifies a user in your bacend. it could email, phone numder, username etc.
164
+
165
+ Available composable state and methods:
166
+
167
+ - `user`
168
+ - `status`
169
+ - `ready`
170
+ - `error`
171
+ - `loading`
172
+ - `isAuthenticated`
173
+ - `login`
174
+ - `socialLogin`
175
+ - `register`
176
+ - `verifyOtp`
177
+ - `fetchUser`
178
+ - `refresh`
179
+ - `logout`
180
+ - `forgotPassword`
181
+ - `resetPassword`
182
+ - `resendOtp`
183
+ - `clearAuthState`
184
+
185
+ ## Redis Sessions
186
+
187
+ The backend token is stored server-side in Redis. The browser only receives a secure HTTP-only session id cookie. Nuxt server routes can read the hydrated session from:
188
+
189
+ ```ts
190
+ event.context.auth;
191
+ ```
192
+
193
+ ## CSRF
194
+
195
+ `nuxt-csurf` is installed by default. You can customize it:
196
+
197
+ ```ts
198
+ export default defineNuxtConfig({
199
+ bearerAuth: {
200
+ csrf: {
201
+ enabled: true,
202
+ cookieKey: "my_app_csrf",
203
+ devCookieKey: "my_app_csrf_dev",
204
+ headerName: "x-csrf-token",
205
+ },
206
+ },
207
+ });
208
+ ```
209
+
210
+ To manage `nuxt-csurf` yourself:
211
+
212
+ ```ts
213
+ export default defineNuxtConfig({
214
+ modules: ["nuxt-csurf", "nuxt-bearer-auth"],
215
+ bearerAuth: {
216
+ installCsurf: false,
217
+ },
218
+ });
219
+ ```
220
+
221
+ ## Route Protection
222
+
223
+ ```ts
224
+ export default defineNuxtConfig({
225
+ bearerAuth: {
226
+ routes: {
227
+ public: ["/", "/login", "/pricing"],
228
+ authPages: ["/login"],
229
+ protectedApiPrefixes: ["/api"],
230
+ publicApiPrefixes: [
231
+ "/api/auth/login",
232
+ "/api/auth/register",
233
+ "/api/_csrf",
234
+ ],
235
+ },
236
+ },
237
+ });
238
+ ```
239
+
240
+ Disable the global client middleware:
241
+
242
+ ```ts
243
+ export default defineNuxtConfig({
244
+ bearerAuth: {
245
+ routes: {
246
+ middleware: false,
247
+ },
248
+ },
249
+ });
250
+ ```
251
+
252
+ ## Community Direction
253
+
254
+ Planned extension points:
255
+
256
+ - first-party adapters for popular backend response shapes
257
+ - optional refresh-token rotation strategies
258
+ - role/permission hooks
259
+ - multi-tenant active context headers
260
+ - session analytics and device naming
261
+ - test fixtures for module consumers
262
+
263
+ ## License
264
+
265
+ MIT
@@ -0,0 +1,5 @@
1
+ module.exports = function(...args) {
2
+ return import('./module.mjs').then(m => m.default.call(this, ...args))
3
+ }
4
+ const _meta = module.exports.meta = require('./module.json')
5
+ module.exports.getMeta = () => Promise.resolve(_meta)
@@ -0,0 +1,134 @@
1
+ declare const module = defineNuxtModule({
2
+ meta: {
3
+ name: "nuxt-bearer-auth",
4
+ configKey: "bearerAuth",
5
+ compatibility: {
6
+ nuxt: "^3.12.0 || ^4.0.0"
7
+ }
8
+ },
9
+ defaults: defaultOptions,
10
+ async setup(moduleOptions, nuxt) {
11
+ const resolver = createResolver(import.meta.url);
12
+ const options = defu(moduleOptions, defaultOptions);
13
+ nuxt.options.runtimeConfig.bearerAuth = defu(
14
+ nuxt.options.runtimeConfig.bearerAuth,
15
+ {
16
+ apiBaseUrl: options.apiBaseUrl,
17
+ redisUrl: options.redisUrl,
18
+ sessionSecret: options.sessionSecret,
19
+ appEnv: options.appEnv,
20
+ endpoints: options.endpoints,
21
+ responsePaths: options.responsePaths,
22
+ sessionCookie: options.sessionCookie,
23
+ verificationRequiredActions: options.verificationRequiredActions,
24
+ twoFactorRequiredActions: options.twoFactorRequiredActions
25
+ }
26
+ );
27
+ nuxt.options.runtimeConfig.public.bearerAuth = defu(
28
+ nuxt.options.runtimeConfig.public.bearerAuth,
29
+ {
30
+ redirects: options.redirects,
31
+ routes: options.routes
32
+ }
33
+ );
34
+ if (options.installCsurf && options.csrf?.enabled) {
35
+ await installModule("nuxt-csurf", {
36
+ https: options.csrf.https,
37
+ cookieKey: options.appEnv === "local" || options.appEnv === "development" ? options.csrf.devCookieKey : options.csrf.cookieKey,
38
+ cookie: options.csrf.cookie,
39
+ methods: options.csrf.methods,
40
+ methodsToProtect: options.csrf.methodsToProtect,
41
+ encryptAlgorithm: "aes-256-cbc",
42
+ addCsrfTokenToEventCtx: true,
43
+ headerName: options.csrf.headerName
44
+ });
45
+ }
46
+ addImports([
47
+ {
48
+ name: "useBearerAuth",
49
+ from: resolver.resolve("runtime/composables/useBearerAuth")
50
+ },
51
+ {
52
+ name: "useBearerAuth",
53
+ as: "useAuth",
54
+ from: resolver.resolve("runtime/composables/useBearerAuth")
55
+ }
56
+ ]);
57
+ addPlugin(resolver.resolve("runtime/plugins/bearer-auth.server"));
58
+ if (options.routes?.middleware !== false) {
59
+ addRouteMiddleware({
60
+ name: "bearer-auth",
61
+ path: resolver.resolve("runtime/middleware/bearer-auth.global"),
62
+ global: true
63
+ });
64
+ }
65
+ addServerPlugin(resolver.resolve("runtime/server/plugins/redis"));
66
+ addServerHandler({
67
+ middleware: true,
68
+ handler: resolver.resolve("runtime/server/middleware/auth")
69
+ });
70
+ const prefix = options.routes?.localApiPrefix || "/api/auth";
71
+ addServerHandler({
72
+ route: `${prefix}/login`,
73
+ method: "post",
74
+ handler: resolver.resolve("runtime/server/api/auth/login.post")
75
+ });
76
+ addServerHandler({
77
+ route: `${prefix}/social-login`,
78
+ method: "post",
79
+ handler: resolver.resolve("runtime/server/api/auth/social-login.post")
80
+ });
81
+ addServerHandler({
82
+ route: `${prefix}/logout`,
83
+ method: "post",
84
+ handler: resolver.resolve("runtime/server/api/auth/logout.post")
85
+ });
86
+ addServerHandler({
87
+ route: `${prefix}/me`,
88
+ method: "get",
89
+ handler: resolver.resolve("runtime/server/api/auth/me.get")
90
+ });
91
+ addServerHandler({
92
+ route: `${prefix}/refresh`,
93
+ method: "post",
94
+ handler: resolver.resolve("runtime/server/api/auth/refresh.post")
95
+ });
96
+ addServerHandler({
97
+ route: `${prefix}/forgot-password`,
98
+ method: "post",
99
+ handler: resolver.resolve("runtime/server/api/auth/forgot-password.post")
100
+ });
101
+ addServerHandler({
102
+ route: `${prefix}/reset-password`,
103
+ method: "post",
104
+ handler: resolver.resolve("runtime/server/api/auth/reset-password.post")
105
+ });
106
+ addServerHandler({
107
+ route: `${prefix}/otp-verification`,
108
+ method: "post",
109
+ handler: resolver.resolve("runtime/server/api/auth/otp-verification.post")
110
+ });
111
+ addServerHandler({
112
+ route: `${prefix}/resend-otp/:identifier`,
113
+ method: "post",
114
+ handler: resolver.resolve("runtime/server/api/auth/resend-otp/[identifier].post")
115
+ });
116
+ addServerHandler({
117
+ route: `${prefix}/register`,
118
+ method: "post",
119
+ handler: resolver.resolve("runtime/server/api/auth/register.post")
120
+ });
121
+ addServerHandler({
122
+ route: `${prefix}/sessions`,
123
+ method: "get",
124
+ handler: resolver.resolve("runtime/server/api/auth/sessions.get")
125
+ });
126
+ addServerHandler({
127
+ route: `${prefix}/sessions/:id`,
128
+ method: "delete",
129
+ handler: resolver.resolve("runtime/server/api/auth/sessions/[id].delete")
130
+ });
131
+ }
132
+ });
133
+
134
+ export { module as default };
@@ -0,0 +1,134 @@
1
+ declare const module = defineNuxtModule({
2
+ meta: {
3
+ name: "nuxt-bearer-auth",
4
+ configKey: "bearerAuth",
5
+ compatibility: {
6
+ nuxt: "^3.12.0 || ^4.0.0"
7
+ }
8
+ },
9
+ defaults: defaultOptions,
10
+ async setup(moduleOptions, nuxt) {
11
+ const resolver = createResolver(import.meta.url);
12
+ const options = defu(moduleOptions, defaultOptions);
13
+ nuxt.options.runtimeConfig.bearerAuth = defu(
14
+ nuxt.options.runtimeConfig.bearerAuth,
15
+ {
16
+ apiBaseUrl: options.apiBaseUrl,
17
+ redisUrl: options.redisUrl,
18
+ sessionSecret: options.sessionSecret,
19
+ appEnv: options.appEnv,
20
+ endpoints: options.endpoints,
21
+ responsePaths: options.responsePaths,
22
+ sessionCookie: options.sessionCookie,
23
+ verificationRequiredActions: options.verificationRequiredActions,
24
+ twoFactorRequiredActions: options.twoFactorRequiredActions
25
+ }
26
+ );
27
+ nuxt.options.runtimeConfig.public.bearerAuth = defu(
28
+ nuxt.options.runtimeConfig.public.bearerAuth,
29
+ {
30
+ redirects: options.redirects,
31
+ routes: options.routes
32
+ }
33
+ );
34
+ if (options.installCsurf && options.csrf?.enabled) {
35
+ await installModule("nuxt-csurf", {
36
+ https: options.csrf.https,
37
+ cookieKey: options.appEnv === "local" || options.appEnv === "development" ? options.csrf.devCookieKey : options.csrf.cookieKey,
38
+ cookie: options.csrf.cookie,
39
+ methods: options.csrf.methods,
40
+ methodsToProtect: options.csrf.methodsToProtect,
41
+ encryptAlgorithm: "aes-256-cbc",
42
+ addCsrfTokenToEventCtx: true,
43
+ headerName: options.csrf.headerName
44
+ });
45
+ }
46
+ addImports([
47
+ {
48
+ name: "useBearerAuth",
49
+ from: resolver.resolve("runtime/composables/useBearerAuth")
50
+ },
51
+ {
52
+ name: "useBearerAuth",
53
+ as: "useAuth",
54
+ from: resolver.resolve("runtime/composables/useBearerAuth")
55
+ }
56
+ ]);
57
+ addPlugin(resolver.resolve("runtime/plugins/bearer-auth.server"));
58
+ if (options.routes?.middleware !== false) {
59
+ addRouteMiddleware({
60
+ name: "bearer-auth",
61
+ path: resolver.resolve("runtime/middleware/bearer-auth.global"),
62
+ global: true
63
+ });
64
+ }
65
+ addServerPlugin(resolver.resolve("runtime/server/plugins/redis"));
66
+ addServerHandler({
67
+ middleware: true,
68
+ handler: resolver.resolve("runtime/server/middleware/auth")
69
+ });
70
+ const prefix = options.routes?.localApiPrefix || "/api/auth";
71
+ addServerHandler({
72
+ route: `${prefix}/login`,
73
+ method: "post",
74
+ handler: resolver.resolve("runtime/server/api/auth/login.post")
75
+ });
76
+ addServerHandler({
77
+ route: `${prefix}/social-login`,
78
+ method: "post",
79
+ handler: resolver.resolve("runtime/server/api/auth/social-login.post")
80
+ });
81
+ addServerHandler({
82
+ route: `${prefix}/logout`,
83
+ method: "post",
84
+ handler: resolver.resolve("runtime/server/api/auth/logout.post")
85
+ });
86
+ addServerHandler({
87
+ route: `${prefix}/me`,
88
+ method: "get",
89
+ handler: resolver.resolve("runtime/server/api/auth/me.get")
90
+ });
91
+ addServerHandler({
92
+ route: `${prefix}/refresh`,
93
+ method: "post",
94
+ handler: resolver.resolve("runtime/server/api/auth/refresh.post")
95
+ });
96
+ addServerHandler({
97
+ route: `${prefix}/forgot-password`,
98
+ method: "post",
99
+ handler: resolver.resolve("runtime/server/api/auth/forgot-password.post")
100
+ });
101
+ addServerHandler({
102
+ route: `${prefix}/reset-password`,
103
+ method: "post",
104
+ handler: resolver.resolve("runtime/server/api/auth/reset-password.post")
105
+ });
106
+ addServerHandler({
107
+ route: `${prefix}/otp-verification`,
108
+ method: "post",
109
+ handler: resolver.resolve("runtime/server/api/auth/otp-verification.post")
110
+ });
111
+ addServerHandler({
112
+ route: `${prefix}/resend-otp/:identifier`,
113
+ method: "post",
114
+ handler: resolver.resolve("runtime/server/api/auth/resend-otp/[identifier].post")
115
+ });
116
+ addServerHandler({
117
+ route: `${prefix}/register`,
118
+ method: "post",
119
+ handler: resolver.resolve("runtime/server/api/auth/register.post")
120
+ });
121
+ addServerHandler({
122
+ route: `${prefix}/sessions`,
123
+ method: "get",
124
+ handler: resolver.resolve("runtime/server/api/auth/sessions.get")
125
+ });
126
+ addServerHandler({
127
+ route: `${prefix}/sessions/:id`,
128
+ method: "delete",
129
+ handler: resolver.resolve("runtime/server/api/auth/sessions/[id].delete")
130
+ });
131
+ }
132
+ });
133
+
134
+ export { module as default };
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "nuxt-bearer-auth",
3
+ "configKey": "bearerAuth",
4
+ "compatibility": {
5
+ "nuxt": "^3.12.0 || ^4.0.0"
6
+ },
7
+ "version": "0.1.0",
8
+ "builder": {
9
+ "@nuxt/module-builder": "0.8.4",
10
+ "unbuild": "2.0.0"
11
+ }
12
+ }