Authentication
Application API is statefull and it uses PHP sessions to maintain the state between the client and the application API.
Login flow (example with full success):
- Client sends a request for the CSRF token
- Application API starts a session and returns the CSRF token
- Client stores the CSRF token
- Client sends the login credentials to the application API and the CSRF token as a header
- Application API validates the CSRF token against the session
- Application API validates login credentials
- Application API returns the success response to the client
Any other requests will contain the session cookie and thus be authenticated as long as the session exists.
Logout flow:
- Client sends a logout request
- Application API kills the current session (removing the CSRF token along the way)
- Application sends the success response