wikipedia-game-solver/apps/api/config/auth.ts

30 lines
792 B
TypeScript
Raw Normal View History

2024-08-09 23:51:41 +02:00
import { defineConfig } from "@adonisjs/auth"
import { tokensGuard, tokensUserProvider } from "@adonisjs/auth/access_tokens"
import type { Authenticators, InferAuthEvents } from "@adonisjs/auth/types"
const authConfig = defineConfig({
default: "api",
guards: {
api: tokensGuard({
provider: tokensUserProvider({
tokens: "accessTokens",
model: async () => {
2024-08-15 15:14:21 +02:00
return await import("#app/models/user.ts")
2024-08-09 23:51:41 +02:00
},
}),
}),
},
})
export default authConfig
/**
* Inferring types from the configured auth guards.
*/
declare module "@adonisjs/auth/types" {
interface Authenticators extends InferAuthenticators<typeof authConfig> {}
}
declare module "@adonisjs/core/types" {
interface EventsList extends InferAuthEvents<Authenticators> {}
}