diff --git a/internal/api/logout.go b/internal/api/logout.go index a2c31a3127..8afec6ae41 100644 --- a/internal/api/logout.go +++ b/internal/api/logout.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" + "github.com/sirupsen/logrus" "github.com/supabase/auth/internal/models" "github.com/supabase/auth/internal/storage" ) @@ -46,13 +47,17 @@ func (a *API) Logout(w http.ResponseWriter, r *http.Request) error { return terr } - //exhaustive:ignore Default case is handled below. - switch scope { - case LogoutLocal: - return models.LogoutSession(tx, s.ID) - - case LogoutOthers: - return models.LogoutAllExceptMe(tx, s.ID, u.ID) + if s == nil { + logrus.Infof("user has an empty session_id claim: %s", u.ID) + } else { + //exhaustive:ignore Default case is handled below. + switch scope { + case LogoutLocal: + return models.LogoutSession(tx, s.ID) + + case LogoutOthers: + return models.LogoutAllExceptMe(tx, s.ID, u.ID) + } } // default mode, log out everywhere