1

I'm experimenting with some basic AuthSub authorization to test out the Google Data API (I'm interested in using the Picasa API). I'm having trouble getting my head around the steps involved in going from requesting the authorization token, to getting the URL with the token, to actually making requests to the server using the token.

Can someone please give me an idea of how I would take the token and then make a request to the server using PHP? Will there have to be Javascript involved?

Also, on a super basic level, when the Google example spells out the following, what language is it, and where would it actually appear like this in code?

GET https://www.google.com/accounts/accounts/AuthSubSessionToken
Authorization: AuthSub token="yourAuthToken"

Thanks for the help, and I'm happy to clarify since I understand these are broad questions.

charliesneath
  • 1,917
  • 3
  • 21
  • 36

1 Answers1

0
GET https://www.google.com/accounts/accounts/AuthSubSessionToken
Authorization: AuthSub token="yourAuthToken"

This is the HTTP request that you should be making, and the example above means that you should include the Authorization field in the headers of an HTTP GET request that you will be making, independent of the language.

You can use PHP's cURL to make this request,

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.google.com/accounts/accounts/AuthSubSessionToken");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); # return output as string instead of printing it out
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: AuthSub token="yourAuthToken"');
$response = curl_exec($ch);

Where is the code that you are using so far?

Arvin
  • 2,272
  • 14
  • 10
  • Not yet, but this makes a little more sense. I don't quite understand, however, what this does step-by-step. It will go to the specified CURLOPT_URL, collect the authorization token provided by the server, and then where does it go from there? – charliesneath Feb 24 '11 at 13:44
  • @zeedog the code above is used when you already have the AuthSub token for a specific user. The token is sent to the server to authorize the GET request. I just answered your last question actually, I haven't read the AuthSub specs yet. – Arvin Feb 24 '11 at 14:48
  • That makes more sense. So this will grab the token from the URL and send it to the server for the authorization? – charliesneath Feb 24 '11 at 15:06