4

I need to retrieve an auth token from an Android device (client side) using AccountManager.getAuthToken and then re-use it via Zend_Gdata (server side)

When using the calendar 'cl' authTokenType things work as expected,

Android source:

String calendarToken = getAuthToken(account, 'cl' ...

PHP source:

$token = // value retrieved via Android 'calendarToken'

$client = new Zend_Gdata_HttpClient;
$client->setClientLoginToken($token);

$gData = new Zend_Gdata($client);
$feed = $gData->getFeed("http://www.google.com/calendar/feeds/default/private/full");

This does work, however when using the Gmail 'mail' authTokenType things are not so smooth

Android source:

String mailToken = getAuthToken(account, 'mail' ...

PHP source:

$token = // value retrieved via Android 'mailToken'

$client = new Zend_Gdata_HttpClient;
$client->setClientLoginToken($token);

$gData = new Zend_Gdata($client);
$feed = $gData->getFeed("https://mail.google.com/mail/feed/atom/");

This keeps throwing a 'Zend_Gdata_App_HttpException' with message 'Expected response code 200, got 401.

I tried to follow guidelines for the various Google Data APIs with no luck

lostsource
  • 21,070
  • 8
  • 66
  • 88

1 Answers1

0

The only reason you should see a difference between AuthSub requests to two services is a scope issue. Review item number three in the AuthSub docs and check to make sure the token you're using has access to GMail.

Paddy
  • 2,793
  • 1
  • 22
  • 27