Update get User & Refresh Token
This commit is contained in:
@@ -19,3 +19,13 @@ func GenerateJWT(userID uint, role string) (string, error) {
|
||||
// INI PALING PENTING ⬇️
|
||||
return token.SignedString([]byte(config.GetConfig().JWTSecret))
|
||||
}
|
||||
|
||||
func GenerateRefreshToken(userID uint) (string, error) {
|
||||
claims := jwt.MapClaims{
|
||||
"user_id": userID,
|
||||
"exp": time.Now().Add(time.Hour * 24).Unix(),
|
||||
}
|
||||
|
||||
token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
|
||||
return token.SignedString([]byte(config.GetConfig().JWTSecret))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user