25 lines
691 B
TypeScript
25 lines
691 B
TypeScript
import { defineConfig } from '@adonisjs/auth'
|
|
import { tokensGuard, tokensUserProvider } from '@adonisjs/auth/access_tokens'
|
|
import type { InferAuthEvents, Authenticators } from '@adonisjs/auth/types'
|
|
|
|
const authConfig = defineConfig({
|
|
default: 'api',
|
|
guards: {
|
|
api: tokensGuard({
|
|
provider: tokensUserProvider({
|
|
tokens: 'accessTokens',
|
|
model: () => import('#models/user'),
|
|
}),
|
|
}),
|
|
},
|
|
})
|
|
|
|
export default authConfig
|
|
|
|
declare module '@adonisjs/auth/types' {
|
|
export interface Authenticators extends InferAuthenticators<typeof authConfig> {}
|
|
}
|
|
declare module '@adonisjs/core/types' {
|
|
interface EventsList extends InferAuthEvents<Authenticators> {}
|
|
}
|