xxxxxxxxxx
func jwtError(c *fiber.Ctx, err error) error {
return c.Status(fiber.StatusUnauthorized).SendString("Access is denied due to invalid credentials")
}
func SetupRouter() *fiber.App {
app := fiber.New()
// JWT Middleware
private := app.Group("/")
private.Use(jwtware.New(jwtware.Config{
SigningKey: []byte(os.Getenv("SECRET")),
TokenLookup: "cookie:Authorization",
ErrorHandler: jwtError,
}))
}