It's all about the answers!

Ask a question

HEADLESS authentication to RTC CCM service using e.g. curl


Marek Bocian (132) | asked Aug 31, 10:17 a.m.

 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


permanent link
Davyd Norris (8567) | answered Aug 31, 7:50 p.m.
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
Marek Bocian selected this answer as the correct answer

One other answer



permanent link
Marek Bocian (132) | answered Sep 01, 8:55 a.m.
edited Sep 01, 8:57 a.m.

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!

Your answer


Register or to post your answer.