HEADLESS authentication to RTC CCM service using e.g. curl
Could you please provide the correct method in order to authenticate to the title RTC CCM service in the headless mode?
I am developing a script that would automate some work (downloading work items' attachments to be precise). In order to do so I tried to authenticate to the server using htpps request with cookies:
curl -kv -c <COOKIE_FILE> <RTC_SERVER>/ccm/authenticated/identity
curl -kv -L -b <COOKIE_FILE> -c <COOKIE_FILE> -d j_username=<username> -d j_password=<password> <RTC_SERVER>/ccm/authenticated/j_security_check
but the reposonse I get from the second requests states e.g.:
<noscript><div id="net-jazz-ajax-NoScriptMessage">Javascript is either disabled or not available in your Browser</div></noscript>
In advance thank you.
Best regards!
Accepted answer
I just used this, which is almost exactly the same as your commands, and it worked perfectly:
set USER=<username>
set PWD=<password>
rem File which will contain the login cookies
set COOKIES=cookies.txt
rem First pass to request the authentication cookie
curl.exe -k -c %COOKIES% https://<server>/ccm/authenticated/identity
rem Second pass to login
curl.exe -k -L -b %COOKIES% -c %COOKIES% -d j_username=%USER% -d j_password=%PWD% https://<server>/ccm/authenticated/j_security_check
rem Request the url using the authentication
curl.exe -k -b %COOKIES% https://<server>/ccm/oslc/workitems/catalog
set PWD=<password>
rem File which will contain the login cookies
set COOKIES=cookies.txt
rem First pass to request the authentication cookie
curl.exe -k -c %COOKIES% https://<server>/ccm/authenticated/identity
rem Second pass to login
curl.exe -k -L -b %COOKIES% -c %COOKIES% -d j_username=%USER% -d j_password=%PWD% https://<server>/ccm/authenticated/j_security_check
rem Request the url using the authentication
curl.exe -k -b %COOKIES% https://<server>/ccm/oslc/workitems/catalog
One other answer
I (as well as my collegaus experiencing the same issue) performed the very same requests on our Windows machines as @Davyd suggested and, indeed, it succeded.
The most bizzare thing is that after the authentication process from Windows platform it works now in the Linux shell as well... ( Yeah, I know how it sounds. :D )
The auth process outcome has been fully verified since now I am able to query all the resources of the given RTC project through OSLC REST API.
Again, thank you for your support!