0

I have a webapp with authentication. Sessions are stored in the DB... session ID is stored in the cookie. Cookie session ID and DB ID are validated on each call and session ID is regenerated...

If I do an ajax request with 2 function calls in it the latter call uses the same cookie (with the old session ID) that the first one did. As soon as the call is accepted by the server side script the session is regenerated and the cookie is updated.

What happens is that the session ID in the second request is invalid (expired) and I get logged out...

How can I resolve this situation?

Thanks!

1 Answer 1

1

The second call must use the cookie that was returned with the first call, otherwise, as you state is uses an old session id which is invalid.

Another option is not to regenerate the session id all the time.

Sign up to request clarification or add additional context in comments.

2 Comments

I know that it must use the returned cookie... but how can I force it to do that?
+1 for not regenerating every time, it's useless. Regen only when authentication/credentials change.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.