mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-14 12:14:33 +01:00
Add infinite token
This commit is contained in:
@@ -35,6 +35,13 @@ export default class AuthController {
|
||||
return token.toJSON()
|
||||
}
|
||||
|
||||
public async createInfiniteToken ({request, auth}: HttpContextContract) {
|
||||
const email = request.input('email')
|
||||
const password = request.input('password')
|
||||
const token = await auth.use('api').attempt(email, password)
|
||||
return token.toJSON()
|
||||
}
|
||||
|
||||
public async logoutWeb ({auth}: HttpContextContract) {
|
||||
await auth.logout()
|
||||
return { message: 'Vous avez été déconnecté' }
|
||||
|
||||
@@ -70,6 +70,7 @@ Route.group(() => {
|
||||
|
||||
Route.group(() => {
|
||||
Route.get('/me', 'AuthController.user').middleware('auth')
|
||||
Route.get('/token', 'AuthController.createInfiniteToken')
|
||||
|
||||
Route.post('/web/login', 'AuthController.loginWeb')
|
||||
Route.post('/web/logout', 'AuthController.logoutWeb')
|
||||
|
||||
Reference in New Issue
Block a user