feat: applied auth wirth session token on dart backend
This commit is contained in:
@@ -106,15 +106,15 @@ func (s *AuthService) Logout(c *gin.Context) {
|
||||
|
||||
func setSessionTokenCookie(c *gin.Context, user entities.User) func(token string) string {
|
||||
return func(token string) string {
|
||||
c.SetCookie("session_token", token, 3600, "/", "localhost", false, true)
|
||||
c.SetCookie("user_id", user.ID, 3600, "/", "localhost", false, true)
|
||||
c.SetCookie("session_token", token, 3600, "/", "", false, true)
|
||||
c.SetCookie("user_id", user.ID, 3600, "/", "", false, true)
|
||||
return token
|
||||
}
|
||||
}
|
||||
|
||||
func deleteSessionTokenCookie(c *gin.Context) {
|
||||
c.SetCookie("session_token", "", -1, "/", "localhost", false, true)
|
||||
c.SetCookie("user_id", "", -1, "/", "localhost", false, true)
|
||||
c.SetCookie("session_token", "", -1, "/", "", false, true)
|
||||
c.SetCookie("user_id", "", -1, "/", "", false, true)
|
||||
}
|
||||
|
||||
func validatePassword(password string) func(user entities.User) E.Either[error, entities.User] {
|
||||
|
||||
@@ -3,7 +3,7 @@ package dto
|
||||
// TokenResponseDTO represents the response for a token generation or validation.
|
||||
type TokenResponseDTO struct {
|
||||
Token string `json:"token"`
|
||||
UserID string `json:"user_id"`
|
||||
UserID string `json:"userId"`
|
||||
}
|
||||
|
||||
// LoginRequestDTO represents the login request.
|
||||
|
||||
Reference in New Issue
Block a user