Using the AuthSub token to make requests for private data
I'm experimenting with some basic AuthSub authorization to test out the Google Data API (I'm inte开发者_运维问答rested 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.
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?
精彩评论