Closed eduardhasanaj closed 4 years ago
Yes, there is no problem with calling commit multiple times during the same request. It's the right way to get the session token that will be used.
Thanks for the confirmation! I am closing this issue.
Sorry for reviving this. I'm also attempting to get the token/session id, but I seem to get a new ID on each page refresh. This is different than what Chrome reports me as the session ID.
I'm using your example code, but added the following handler:
func sessionHandler(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
// sessionManager.RenewToken(ctx)
id, _, _ := sessionManager.Commit(ctx)
io.WriteString(w, id)
}
This is what I see when I reach that endpoint:
My expectations were that these numbers would match, but they don't. Any idea what I'm doing wrong?
Sorry for writing again about expire session time. I am in need to retrieve session token from context so I can register it to an expiry system. Is there any workaround? Will break anything if i call commit in the handler. I know that after request finishes commit will be called again. Best wishes