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