@witchcraft/nuxt-auth 0.1.0 → 0.1.2
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.
package/README.md
CHANGED
|
@@ -318,7 +318,7 @@ Then create a class that implements `ProviderHandler<type, PROVIDER_NAME>` which
|
|
|
318
318
|
See the included providers for examples. They're quite simple to write with the help of the `arctic` library.
|
|
319
319
|
|
|
320
320
|
```ts
|
|
321
|
-
export default createAuthHandler(useRuntimeConfig(), db, users, authAccounts, sessionManager, {
|
|
321
|
+
export default createAuthHandler(useRuntimeConfig(), db, users, authAccounts, sessionManager, useServerLogger(), {
|
|
322
322
|
customProviders: {
|
|
323
323
|
name: class CustomProvider implements ProviderHandler<"oauth2", "customProvider"> {
|
|
324
324
|
//...
|
package/dist/module.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { BaseLogger } from "@witchcraft/nuxt-logger/createUseLogger";
|
|
2
2
|
import type { SessionManager } from "./SessionManager.js.js";
|
|
3
3
|
import type { AuthSession, AuthUser } from "../../types.js.js";
|
|
4
|
-
export declare function createAuthMiddleware(
|
|
4
|
+
export declare function createAuthMiddleware(sessionManager: SessionManager, logger: BaseLogger): any;
|
|
5
5
|
declare module "h3" {
|
|
6
6
|
interface H3EventContext {
|
|
7
7
|
user: AuthUser | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineEventHandler, getCookie, setCookie } from "#imports";
|
|
2
|
-
export function createAuthMiddleware(
|
|
2
|
+
export function createAuthMiddleware(sessionManager, logger) {
|
|
3
3
|
return defineEventHandler(async (event) => {
|
|
4
4
|
const sessionId = getCookie(event, sessionManager.options.sessionCookie.name) ?? null;
|
|
5
5
|
if (!sessionId) {
|