I would like to know what is best practice with AJAX authentication process.
When authentication is valid I return HTTP header 200 with response “ok”
What HTTP header do I need to send from server if authentication is NOT valid.
- Do I need to set HTTP header to code 500 (ERROR)
- or leave it on 200 and implement logic which checks response variable?
How about returning HTTP401?
You can handle in in AJAX error handler and redirect the whole page to login screen, if it’s your requirement.