13 lines
252 B
Go
13 lines
252 B
Go
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
|
|
}
|