Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

275
Views
curl for javascript-based authentication

I need to login from command line to a site which doesn't use a for authentication, but it's own javascript routine. It has a normal login box in the upper left corner where it asks for username (

For the username-box the code is

<input name="dnn$ctr480$View$tbUsername" type="text" id="tbUsername" class="textboxcss dnnFormRequired">

For the password-box the code is

<input name="dnn$ctr480$View$tbPassword" type="password" id="tbPassword" class="textboxcssPW dnnFormRequired">

and the "Login" Button has the following code:

<a onclick="return loginValidation();" id="dnn_ctr480_View_cmdLogin" class="imageLogin" allowtransparency="true"  href="javascript:__doPostBack('dnn$ctr480$View$cmdLogin','')"></a>

I did a successful login with the browser and then copied the request which was sent to get a page once I was logged in. It includes (besides other stuff) the following:

-H 'Cookie: .ASPXANONYMOUS=6aLumAgb2AEkAAAAYjIyMjA3Y2MtOTMwNi00OGQwLWI2ZTMtYzExNTE1M2Y5MDIy0; Analytics_VisitorId=6e8f281f-156a-4a8c-b41f-c50252b3a88b; PORTAL_REDIRECT=lastPage=https%3a%2f%2fportal.example.org%2flogin.aspx%3fReturnUrl%3d%252fngppapp%252fCreateTTTdoc.aspx%253fmode%253dview%2526contributionUId%253dC1170%26mode%3dview%26contributionUId%3dC1170; ASP.NET_SessionId=tudiol5m4um01yriigqwstgc; dnn_IsMobile=False; language=en-US; __RequestVerificationToken=jyoeX6KECMhBmChQpE3VtzECboYmfRF--mS-dc23E_tZu_mDIuJsTE9BTryrSMRGFYd-Wg2; Tbs=All; Location=All; PresenceTypeAllowed=0; StartDate=2021-11-14; EndDate=2022-11-14; StartEndDates=-1; LastPageId=0:191; authentication=; .DOTNETNUKE=820FD02418EA31BB59422479C0A4B582DE5113DED12DBF8A7B2A6CAD32EDE80630D6AC69A808CE29F68F0074B8BAE10D7646F97A9CC1AD642418416AE8DCEF4EA45E253C9FF6FA999782D35A687E3A76B85C7F9C88EA71D089DE328F7CD72EE676811C642600A45337C8346D; Analytics=SessionId=838325b4-4320-427e-ad10-0b9a4314ef75&TabId=191&ContentItemId=-1' 

I now tried with several tricks from command line:

curl -c cookie -s https://site.example.org/ -o sitefile -d "tbUsername=myusername&tbPassword=mypassword"

I got back a cookie file. But then when trying to open one of the web-pages

curl -b cookie -s https://site.example.org/page -o pagefile 

it only redirected me to a page which said that I need to login first.

I tried several variants of this, e.g. in the first curl request (the one for login) I put -d "user=myusername&password=mypassword" and so forth - but nothing worked.

My understanding is, that the first curl request (for login) is not working correctly when there is a javascript routine which checks my authentication.

Is there a way to use curl (or any other CLI command) to allow me to login to this server?

Thanks for your kind help!

Georg

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!