Alex Rivera | Logout

Making AJAX calls secure

Asked 2010-06-04T05:56:01.553
17

What happens if a user looks at my JavaScript file, copies the content of a function and sends a request to my server using AJAX? And is there a way to properly protect against this from happening?

Edit
Report

1 Answer

15

The way to protected against this is no different to the way you protected against any web request. You make it so that your site requires some form of authentication (i.e. users have to log in) and don't do thing if the request is not properly authenticated.

Typically, when you make an AJAX request, cookies are also sent along with the request so you should just be able to use the same authentication method that you use for your regular requests with your AJAX requests.

answered 2010-06-04T05:58:54.993

Your Answer