From 85bbd1223e6ab9eaf47643e90297a79eb87c0d9e Mon Sep 17 00:00:00 2001 From: Lakhan Samani Date: Wed, 1 Nov 2023 18:12:56 +0530 Subject: [PATCH] Fix validating session --- server/resolvers/validate_session.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/server/resolvers/validate_session.go b/server/resolvers/validate_session.go index 39adb1f4f..e5be53956 100644 --- a/server/resolvers/validate_session.go +++ b/server/resolvers/validate_session.go @@ -20,7 +20,16 @@ func ValidateSessionResolver(ctx context.Context, params *model.ValidateSessionI log.Debug("Failed to get GinContext: ", err) return nil, err } - sessionToken := params.Cookie + sessionToken := "" + if params != nil && params.Cookie != "" { + sessionToken = params.Cookie + } else { + sessionToken, err = cookie.GetSession(gc) + if err != nil { + log.Debug("Failed to get session token: ", err) + return nil, errors.New("unauthorized") + } + } if sessionToken == "" { sessionToken, err = cookie.GetSession(gc) if err != nil {