Include query ujs and csrf tags for hootsuite app.
Newest code with logout finished. Needs params passed as query string.
Recompile.
Recompile. Newest backbone with updated authentication.
   * SSO auth issue with HS

      *
I am storing the hoosuite parameters in a cookie so that its there for rest of the requests.
For each request, I am checking if the hootsuite user_id is present and if it matches with the token when created hash with SHA1.

So when you are accessing the application via localhost:3000 (not via hootsuite app), you may not be authencated.
Here is a hack if you really need to try localhost:3000,

1) Login to hootsuite localhost app and try signing in once.
2) This will store the required parameters in cookie (localhost)
3) Now try accessing localhost:3000 from a new tab and it should work.

The cookies should be deleted once the user logout.
I am currently working on this along with passing the hs params to login page.

   * Fixing the logout issue

      *
I modified the redirecURL we give to brandwatch at the time of authentication to include all the parameters given by hootsuite.
In that way the landing_page will now have all hootsuite params.

So the landing_page url looks like the following:

/hootsuite/landing_page?action=new&controller=sessions&i=2370776&isSsl=1&lang=en&pid=1459269&theme=blue_steel&timezone=-21600&token=d7c816cf55098d7c18a674408c45f22aff70704f&ts=1374033105&uid=2370776

   * Adding Parameters to redirect url after logging out - Done

      * This is done to avoid loosing hoot suite parameter when the user logs out