2021-04-08 22:57:23 +12:00
|
|
|
const Router = require("@koa/router")
|
2021-04-11 22:35:55 +12:00
|
|
|
const { passport } = require("@budibase/auth")
|
2021-04-08 22:57:23 +12:00
|
|
|
const authController = require("../controllers/auth")
|
|
|
|
|
|
|
|
const router = Router()
|
|
|
|
|
2021-04-11 22:35:55 +12:00
|
|
|
router
|
|
|
|
.post("/api/admin/auth", authController.authenticate)
|
2021-04-14 00:56:28 +12:00
|
|
|
.post("/api/admin/auth/logout", authController.logout)
|
2021-04-11 22:35:55 +12:00
|
|
|
.get("/api/auth/google", passport.authenticate("google"))
|
|
|
|
.get(
|
|
|
|
"/api/auth/google/callback",
|
|
|
|
passport.authenticate("google", {
|
|
|
|
successRedirect: "/app",
|
|
|
|
failureRedirect: "/",
|
|
|
|
})
|
|
|
|
)
|
2021-04-08 22:57:23 +12:00
|
|
|
|
|
|
|
module.exports = router
|