Skip to content

Commit

Permalink
Fix validating session
Browse files Browse the repository at this point in the history
  • Loading branch information
lakhansamani committed Nov 1, 2023
1 parent 885a147 commit 85bbd12
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion server/resolvers/validate_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 85bbd12

Please sign in to comment.