Files
artdanj-api/start/routes/auth.ts
Arthur DANJOU f12e544a49 Working
Signed-off-by: Arthur DANJOU <arthurdanjou@outlook.fr>
2021-07-07 13:26:15 +02:00

24 lines
747 B
TypeScript

import Route from "@ioc:Adonis/Core/Route";
Route.group(() => {
Route.get('/me', 'AuthController.user').middleware('auth')
Route.post('/token', 'AuthController.createInfiniteToken')
Route.post('/login', 'AuthController.login')
Route.post('/logout', 'AuthController.logout')
Route.get('/twitter/callback', 'AuthController.twitter')
Route.get('/github/callback', 'AuthController.github')
Route.get('/google/callback', 'AuthController.google')
Route.get('/twitter', async ({ally}) => {
return ally.use('twitter').redirect()
})
Route.get('/github', async ({ally}) => {
return ally.use('github').redirect()
})
Route.get('/google', async ({ally}) => {
return ally.use('google').redirect()
})
}).prefix('/auth')