Google AuthSubSessionToken, 401 Unauthorized

  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post October 29th, 2010, 3:13 pm

If you're getting a "401 Unauthorized" response from Google when trying to exchange your single-use token for a long-term session token, then point your HTTP request at something that will show you your request headers (for instance something with phpinfo() in it for PHP) and make sure your Authorization: AuthSub token="token" header is actually being sent.

If you're using cURL and PHP, make sure that you're passing an array with the CURLOPT_HTTPHEADER key to curl_setopt and not a string or else cURL will ignore it.

Good


PHP Code: [ Select ]
curl_setopt($connection, CURLOPT_HTTPHEADER, array('Authorization: AuthSub token="token"'));


Bad


PHP Code: [ Select ]
curl_setopt($connection, CURLOPT_HTTPHEADER, 'Authorization: AuthSub token="token"');


Feel free to assume I didn't just spend an hour figuring this out. :D
Strong with this one, the sudo is.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post October 29th, 2010, 3:13 pm

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 230 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.