about json rpc calls, how do I know if the tryton server invalidates the session by timeout?
I would like to know how to redirect the user to login if the session has expired.
Yes, the sessions are invalidated by a timeout defined on the configuration. Note that the session may last longer, but a fresh session should be required for some operations (like posting an invoice).
The server will return and UNAUTHORIZED (401) http status when the session has expired.
P.S: For testing prouposes you can delete the ir.session table to mark all the active sessions as expired.
from the server I see the 401 status code.
My problem is how to capture it to manage it in php. I tried with
but I get the error 302…
You must expect to receive a 401 for any call as the session can expire at any time.
If you do not want to have such burden, you can use Basic Authentication but it is slower because the server has to check the expensive password hash.
I understand what you mean and that’s what I want to do.
In the php script that Albert passed to me, and which I modified according to my needs, I receive the message “Unable to connect to the server” …
How can I get 401 code as an answer?
Where am I wrong?