Skip to content

Commit

Permalink
Fixed bug with Logout
Browse files Browse the repository at this point in the history
  • Loading branch information
Ju-Wiluis William Rodriguez Hernandez committed Sep 23, 2024
1 parent 63ea9fa commit 97eb8cc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 2 additions & 1 deletion handlers/logout.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package handlers
import (
"encoding/json"
"net/http"
"strings"

"github.com/Luis97lol/auth-service/redis"
)
Expand All @@ -18,7 +19,7 @@ func LogoutHandler(w http.ResponseWriter, r *http.Request) {
// Validate token against Redis
userId, err := redis.ValidateToken(token)
if err == nil {
redis.DeleteToken(token, userId)
redis.DeleteToken(token, strings.Split(userId, ",")[1])
}

// Respond with username
Expand Down
2 changes: 0 additions & 2 deletions redis/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ func GetDefaultTTL(orgId, userId string) time.Duration {

func RenewToken(token string) (string, error) {
data, _ := ValidateToken(token)
println("Data en el Renew:", data)
splited := strings.Split(data, ",")
fmt.Printf("Array en el Renew: %v", splited)
DeleteToken(token, splited[1])
return GenerateToken(splited[0], splited[1])
}
Expand Down

0 comments on commit 97eb8cc

Please sign in to comment.