Я работаю над проектом, и я хочу войти в Qaru через cURL.
Я использую Google как поставщик openID, что означает, что мне нужно сначала войти в Google через свой API.
Вот код, который у меня есть до сих пор:
#!/bin/sh
. ./params.sh #the script with $username and $password
curl --silent https://www.google.com/accounts/ClientLogin \
-d Email=$username -d Passwd=$password \
-d accountType=GOOGLE \
-d source=localhost-test-1 \
-d service=lso \
-o tokens
. ./tokens
echo $Auth; #$Auth is correct here - I did not get a BadAuth error.
endpoint="https://www.google.com/accounts/o8/id";
curl http://stackoverflow.com/users/authenticate \
-d "openid_identifier=$endpoint" \
-w %{redirect_url}> ./google_url
google_url=$(cat ./google_url);
echo $google_url;
echo;
echo;
echo;
curl -L --silent --header "Authorization: GoogleLogin auth=$Auth" $google_url;
На этом этапе я получаю страницу от Google, сообщающую мне, что Qaru хочет получить информацию, и я должен войти в систему. Согласно эта страница, часть --header ... $Auth
должна считаться логином и перенаправлять меня на Stack Overflow.
Вот форма, которую я получаю, когда запускаю этот script:
<form id="gaia_universallogin"
action="https://www.google.com/accounts/ServiceLoginAuth?service=lso" method="post">
<input type="hidden" name="continue" id="continue"
value="https://www.google.com/accounts/o8/ud?st=SOME_KEY" />
<input type="hidden" name="service" id="service"
value="lso" />
<input type="hidden" name="dsh" id="dsh"
value="SOME_NEG_NUMBER" />
</form>
Когда я попробую ответить ниже, я получаю следующую ошибку:
Can't call method "attr" on an undefined value at - line 8.
curl: (3) <url> malformed
--></style>
вот результат от google2.html
<form id="gaia_loginform"
action="https://www.google.com/accounts/ServiceLoginAuth?service=lso" method="post" >
<input type="hidden" name="continue" id="continue" value="https://www.google.com/accounts/o8/ud?st=RNADOM" />
<input type="hidden" name="service" id="service" value="lso" />
<input type="hidden" name="dsh" id="dsh" value="NEG_NUMEBER" />
<input type="hidden" name="GALX" value="ABCD" />
<input type="text" name="Email" id="Email" />
<input type="password" name="Passwd" id="Passwd" >
<input type="checkbox" name="PersistentCookie" id="PersistentCookie" value="yes"
<input type="hidden" name='rmShown' value="1" />
<input type="submit" class="gaia le button" name="signIn" id="signIn" />
<input type="hidden" name="asts" >
</form>