calendrier/controllers/utils.go

14 lines
252 B
Go
Raw Normal View History

2024-02-25 00:10:45 +00:00
package controllers
import (
"github.com/gofiber/fiber/v2"
"github.com/golang-jwt/jwt/v5"
)
func GetName(c *fiber.Ctx) string {
t := c.Locals("user").(*jwt.Token)
claims := t.Claims.(jwt.MapClaims)
name := claims["name"].(string)
return name
}