cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Login with cURL and Token don't work

From: Ray Satiro via curl-library <curl-library_at_cool.haxx.se>
Date: Tue, 19 May 2015 19:22:43 -0400

On 5/19/2015 6:48 AM, avrman_at_fantasymail.de wrote:
> Can somebody help me please, to realise a cURL-Login to the
> WebRadio-Site "www.Phonostar.de" ?
> At first i create a cookie and get the token:
> $token = curl -s -k -c cookie.txt
> https://www.phonostar.de/radio/radioaufnehmen/radiocloud/login | grep
> csrf-token | awk '{print $2}'| sed 's/content=\"//;s/.$//'
> After that i use the cookie and the token to login with my Testaccount
> (before i recorded the login information with LiveHTTP headers in
> FireFox):
> curl -s -k -b cookie.txt -d utf8=\u2713 -d authenticity_token=$token
> -d user[email]=vofaden_at_trickmail.net -d user[password]=curllogin -d
> user[remember_me]=0 -d button=
> https://www.phonostar.de/radio/radioaufnehmen/radiocloud/login
> To test the login i navigate through the site with the follow command:
> curl -s -k -b cookie.txt
> http://www.phonostar.de/radio/sunshinelive/aufnehmen
> but in the answer for this request i get the information, that i don't
> logged in...
> What's wrong here ?
> You can use the Test-Account to help me, please.

I don't know if it's acceptable to do \u directly like that. It doesn't
work for me. If your printf supports it you should be able to do
--data-urlencode `printf "utf8=\u2713"`. In Windows I would do this
equivalent:
-d utf8=%E2%9C%93

And you need to pass the referer:
-e https://www.phonostar.de/radio/radioaufnehmen/radiocloud/login

Optional but for security if I were you I'd disallow insecure
connections and save only the first csrf content of base64 characters to
token, ie [A-Za-z0-9+/=]. hasty example:
token=`curl -s -c cookie.txt
https://www.phonostar.de/radio/radioaufnehmen/radiocloud/login | grep
csrf-token | sed -n
'1!d;s/.*content=\"\([A-Za-z0-9+/]\+=\{0,2\}\)\".*/\1/p'`
and then:
--data-urlencode authenticity_token=$token

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-05-20