Forums/Using Cloud9 IDE/Tips and Tricks

Accessing your private running project via Javascript or cURL

Detmar ter Huurne
posted this on April 05, 2012 12:39

Access your private running project

There are two way to access a private running project.

Javascript

See this example:

https://github.com/janjongboom/c9integration/blob/master/runvm.js

You will need 2 modules for this: request and jsdom. Jsdom can give problems every now and then on our servers, because Contextify doesn't run properly on Solaris. Therefore, you should do

$ npm install jsdom@0.2.1

, to force an older version without contextify.

To authenticate and access, you should change line 39 in runvm.js to the URL you want to use and set your credentials in line 33.

cURL

If you want to do curl, then use a cookie jar, first login via:

$ curl --data "username=XXXX&password=XXXX" --cookie-jar cookies.txt http://c9.io/auth/login

Then do requests to your server like (First use the dashboard URL to check whether the authentication succeeded) 

$ curl --cookie cookies.txt --cookie-jar cookies.txt --dump-headers headers.txt http://c9.io/dashboard.html

To check authentication

cat headers.txt | grep location

Then you should see your username. If so, you can now access your private running projects!.