markbates / markbates/goth

Session Cookie not setting correctly

Open
#626 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
6.6k
Forks
631
PR merge metrics
No merged PRs in 30d

Description

I'm trying the example with the following cookie store:

```
store := sessions.NewCookieStore([]byte(os.Getenv("SESSION_SECRET")))
store.MaxAge(86400 * 30)
store.Options.Domain = ""
store.Options.SameSite = http.SameSiteLaxMode
store.Options.Path = "/"
store.Options.HttpOnly = true // HttpOnly should always be enabled
store.Options.Secure = false

gothic.Store = store
```

I can successfully log in with the provider, but the response shows two `Set-Cookie` headers for `_gothic_session`, one that looks correct, the other which is much shorter, but expires in 1970. The one that expires in 1970 appears second, and I believe is not allowing the correct cookie to be stored in the browser.

Has anyone seen something similar to this before?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the example configuration and inspecting the response's Set-Cookie headers, especially the second cookie that expires in 1970. Done means the login response emits a valid session cookie that the browser stores and uses successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
authentication
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.