Hi Nate,
The AuthSub/OAuth scope and feed URIs don't
change when using a Google Apps account.
Just use the ones that are documented.

Your scope should be:
http://docs.google.com/feeds

and your query should hit:
http://docs.google.com/feeds/documents/private/full

Does that work?
Eric

On Mon, Jun 22, 2009 at 12:30 PM, Nate <nate.wa...@gmail.com> wrote:

>
> I started to build a proof of concept based off the sample PHP code in
> the Google Docs API reference and can't get it to completely work.  I
> did manage to get it to authenticate with our Google Apps login here,
> but no further.
>
> My code looks like this:
>
> <?php
> $path = '/usr/cwis/data/www-data/gapps_testbed/ZendGdata-1.8.3/
> library';
> set_include_path($path);
>
> require_once('Zend/Gdata/AuthSub.php');
> require_once('Zend/Gdata/Docs.php');
>
> function getAuthSubUrl()
> {
>        $next = 'http://localhost:8081/gapps_testbed/index.php';
>        $scope = 'http://docs.google.com/a/acollege.edu/feeds/documents/
> private/full';
>        $secure = false;
>        $session = true;
>        return Zend_Gdata_AuthSub::getAuthSubTokenUri($next, $scope,
> $secure,
> $session, 'u.rochester.edu');
> }
>
> session_start();
>
> //$_SESSION['sessionToken'] = null;
> function getAuthSubHttpClient() {
>    if (!isset($_SESSION['sessionToken']) && !isset($_GET['token']) ){
>        echo '<a href="' . getAuthSubUrl() . '">Login!</a>';
>        exit;
>    } else if (!isset($_SESSION['sessionToken']) && isset($_GET
> ['token'])) {
>        $_SESSION['sessionToken'] =
> Zend_Gdata_AuthSub::getAuthSubSessionToken($_GET['token'], null,
> 'http://docs.google.com/a/acollege.edu/');
>    }
>    $httpClient = Zend_Gdata_AuthSub::getHttpClient($_SESSION
> ['sessionToken']);
>    return $httpClient;
> }
>
> $gdClient = new Zend_Gdata_Docs(getAuthSubHttpClient());
>
> function retrieveAllDocuments($gdClient, $html)
> {
>  if ($html) {echo "<h2>Your documents</h2>\n";}
>  $feed = $gdClient->getDocumentListFeed();
>  printDocumentsFeed($feed, $html);
> }
>
> function printDocumentsFeed($feed, $html)
> {
>  if ($html) {echo "<ul>\n";}
>
>  // Iterate over the document entries in the feed and display each
> document's
>  // title.
>  foreach ($feed->entries as $entry) {
>    if ($html) {
>        // Find the URL of the HTML view of the document.
>        $alternateLink = '';
>        foreach ($entry->link as $link) {
>            if ($link->getRel() === 'alternate') {
>                $alternateLink = $link->getHref();
>            }
>        }
>        // Make the title link to the document on docs.google.com.
>        echo "<li><a href=\"$alternateLink\">\n";
>    }
>    echo "$entry->title\n";
>    if ($html) {echo "</a></li>\n";}
>  }
>  if ($html) {echo "</ul>\n";}
> }
>
> printDocumentsFeed(retrieveAllDocuments($gdClient, true), true);
> ?>
>
> When I try and run this, I get a Zend_Gdata_App_HttpException from a
> 401 from Google.
>
> If I try to pass a URL like
> http://docs.google.com/a/acollege.edu/feeds/documents/private/full
> into getDocumentListFeed, I get a 404.
>
> Can anyone lend me a little insight?
> Thanks a bunch.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Docs Data APIs" group.
To post to this group, send email to Google-Docs-Data-APIs@googlegroups.com
To unsubscribe from this group, send email to 
google-docs-data-apis+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Docs-Data-APIs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to