Skip to content

Instantly share code, notes, and snippets.

@IskenHuang
Created January 8, 2013 15:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IskenHuang/4484588 to your computer and use it in GitHub Desktop.
Save IskenHuang/4484588 to your computer and use it in GitHub Desktop.
Google oauth login from curl
/*
* Step 1. get access token using curl
* https://developers.google.com/gdata/articles/using_cURL
*
* service name list
* https://developers.google.com/gdata/faq#clientlogin
*
*/
curl https://www.google.com/accounts/ClientLogin \
--data-urlencode Email=YOUR_GOOGLE_ACCOUNT \
--data-urlencode Passwd=YOUR_PASSWORD \
-d accountType=GOOGLE \
-d service=YOUR_SERVICE_NAME
/*
* Example Response
* SID=DQAAAHYBADCv2pSv7nflacDNwz3zEDUGtrSvNVDcpkSfddi77b3U5sEaHmP8YLWhmA36F9rk85mL8J5dqo4apn0T1vKz0fPGI9Xtnuet6cuE2ZzYvrNIwbSC_HjTqF4zudNQnnlDuD2wqZT-g1qXI8KhGAQZV4NexHZoQPlabTsGuRZeIBxj1A
* LSID=EUBBBIaBADCl-kNxvRVmcQghpt3cqSMfEooKR9flLOUZqwgP9OrZS83gse-KSdTNeXhxsET7FYenDhceP9lIPOmesH-t9qh-AWUHjjMdZEbUNeF9mWyzln6Z-FajaiG-cVFkqW0ZJ8ZbnCP30xXj6xFK6QxaAcqy_9Pej8jhEnxS9E61ftQGPg
* Auth=EUBBIacAAADK-kNxvRVmcQghpt3cqSMfEooLNMflLNIQqwgP9OrZS83gs-KSdTNeXhxsET7FYePWmaD8Vsy1V4LSUGMUP48Je2TO8OcjBj6HgAtPhiZeX-gKDfagZDK44j4n-Tkb44nhOnp2_QPSnBj3Z2vYwOEDjjG3Q53aQVC2132JKOuGh
*
* Auth >> token
*
*/
/*
* Step 2. Example Request
*
*/
curl --silent --header "Authorization: GoogleLogin auth=YOUR_TOKEN" "YOUR_URL"
@DreadPirateShawn
Copy link

Fwiw, this no longer works -- now simply returns the URL https://developers.google.com/identity/protocols/AuthForInstalledApps which provides the following message:

Important: ClientLogin has been officially deprecated since April 20, 2012 and is now no longer available. Requests to ClientLogin will fail with a HTTP 404 response. We encourage you to migrate to OAuth 2.0 as soon as possible.

@swdevbali
Copy link

any update on using Curl with oAuth 2.0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment