Imroved code flow for security.

Requests now must be authenticated BEFORE the action/clientData is
retrieved.