diff --git a/handlers/login.go b/handlers/login.go index cd81738..4717d57 100644 --- a/handlers/login.go +++ b/handlers/login.go @@ -164,9 +164,8 @@ func (aH *AccessHandler) Refresh(c *gin.Context) { username := claims["username"].(string) id := int(claims["id"].(float64)) - role := claims["role"].(string) - _, hasError := aH.getUserFromDB(c, username) + user, hasError := aH.getUserFromDB(c, username) if hasError { return } @@ -177,7 +176,7 @@ func (aH *AccessHandler) Refresh(c *gin.Context) { newAccess := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{ "id": id, "username": username, - "role": role, + "role": user.Role, "exp": accessExp.Unix(), }) accessString, _ := newAccess.SignedString(ACCESS_SECRET)