The F95Zone forum uses the Xenforo platform as a basis. This platform uses cookies to monitor the session and the logged in user. In particular, these three standard cookies are used (from the official page):
- xf_csrf [Session]: Stores a token, unique to you, which is used to verify that the actions you perform on this site were intended to be performed by you.
- xf_session [Session]: Stores the current ID of your session.
- xf_user [Permanent]: Stores a key, unique to you, which allows us to keep you logged in to the software as you navigate from page to page.
On the forum, the passage of cookies is as follows:
- The unauthenticated user connects to the platform. It is provided with an
xf_csrfcookie. - The user decides to log in from the form. To avoid CSRF vulnerabilities, the
xf_csrfcookie is used to generate the_xfTokentoken, used in the user's POST requests to the forum - After authentication, the user receives the
xf_sessionandxf_usercookies - The user closes the browser and the
xf_csrfandxf_sessioncookies are deleted because of the session - The user reopens the browser and connects to the forum: since you are already an open session (
xf_user) it is not necessary to log in again. - When the user connects to the platform, he receives a new
xf_csrfcookie. If the user is also logged in (as in this case) he also gets thexf_sessioncookie. - After connecting to the platform and receiving the cookies, the
_xfTokentoken is also regenerated. This process is automatically performed by the platform. If this last step does not have to be performed, even though the user is authenticated, every POST request will be rejected for security reasons.
To manage the correct procedure, F95API:
- Authenticates and obtains all cookies, saving them on disk (in the temporary folder)
- When a new session is instantiated, if these cookies are present they are recovered (with the exception of the session cookies which are ignored)
- A request is made to the platform for new session cookies (
xf_csrfandxf_session) and to update the_xfTokentoken - The API is ready to use