This repository has been archived on 2024-10-12. You can view files and clone it, but cannot push or open issues or pull requests.
wikipedia-game-solver/apps/api/config/auth.ts
Théo LUDWIG 4add77856e
All checks were successful
Chromatic / chromatic (push) Successful in 2m58s
CI / ci (push) Successful in 4m43s
CI / commitlint (push) Successful in 15s
chore: try Adonis Tuyau
2024-08-16 01:50:11 +01:00

30 lines
792 B
TypeScript

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 () => {
return await import("#app/models/user.ts")
},
}),
}),
},
})
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> {}
}