Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The Google login service is specific to the particular service you're using (Google docs vs Google Analytics vs Google Maps etc). The service ode you've specified (lh2) is specific to Google Picasa.</p> <p>Unfortunately there doesn't seem to be an equivalent code for OpenId (at least, not that I could find!)</p> <p>The page that you get back from Google should contain a login form. If you look at that, it should be possible to construct a curl invocation to log in; that should then redirect you back to SO (or whichever openID page you want to log in to) logged in.</p> <p>It turns out that doing this is a little tricky, because you have to parse out some of the the form fields to submit them back to Google, and because Google doesn't send back a straight HTTP redirect, but an HTML doc with a <code>&lt;meta http-equiv="redirect" ...&gt;</code> tag. And of course you have to enable cookies. But this is all possible in a script using curl - the following works for me:</p> <pre><code>#!/bin/bash # Utility function for parsing values out of an HTML form get_value() { local tagtype="$1" attrname="$2" attrvalue="$3" getattr="$4" perl -MHTML::TreeBuilder - "$@" &lt;&lt;EOF @args=@ARGV; \$h=HTML::TreeBuilder-&gt;new; \$h-&gt;parse_file("$htmlfile"); while (\$#args &gt; 0) { \$h=\$h-&gt;look_down(_tag =&gt; shift @args, shift @args =&gt; shift @args); } print \$h-&gt;attr(shift @args); EOF } # Empty the cookie jar cj="cookiejar" rm -f "$cj" # Attempt to log in to SO. This will redirect to a google URL. endpoint="https://www.google.com/accounts/o8/id" google_url=`curl -L -s -S http://stackoverflow.com/users/authenticate \ -d "openid_identifier=$endpoint" \ -o /dev/null -b "$cj" -c "$cj" \ -w %{url_effective}` echo $google_url echo echo # Retrieve the form from Google htmlfile=googleform.html curl -L -s -S -o "$htmlfile" -b "$cj" -c "$cj" "$google_url" # Parse out the form fields form_url=`get_value form id gaia_loginform action` fdsh=`get_value form id gaia_loginform input name dsh value` fcontinue=`get_value form id gaia_loginform input name continue value` fservice=`get_value form id gaia_loginform input name service value` fGALX=`get_value form id gaia_loginform input name GALX value` frmShown=`get_value form id gaia_loginform input name rmShown value` fsignIn=`get_value form id gaia_loginform input name signIn value` fEmail='INSERT LOGIN EMAIL HERE' fPasswd='INSERT PASSWORD HERE' # Submit the login form htmlfile=google2.html curl -L -s -S -o "$htmlfile" -b "$cj" -c "$cj" --data-urlencode dsh="$fdsh" \ --data-urlencode continue="$fcontinue" \ --data-urlencode service="$fservice" \ --data-urlencode GALX="$fGALX" \ --data-urlencode Email="$fEmail" \ --data-urlencode Passwd="$fPasswd" \ --data-urlencode rmShown="$frmShown" \ --data-urlencode signIn="$fsignIn" \ "$form_url" # Interpret the redirect redirect=`get_value meta http-equiv refresh content | sed "s/^.*'\(.*\)'.*$/\1/"` # Follow it htmlfile=google3.html curl -L -s -S -o "$htmlfile" -b "$cj" -c "$cj" "$redirect" </code></pre> <p>(Note that I seem to have a slightly different version of curl from you, so I had to change the <code>-w</code> options slightly; I'm guessing my version will work for you but you may need to tweak it.)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload