On Nov 13, 7:33 am, Lluis <[EMAIL PROTECTED]> wrote:
> Hi,
>
> There isn't any example showing how could I setup a two-legged
> consumer?
> I'm trying with below options
>
> $options = array(
> 'requestScheme' => Zend_Oauth::REQUEST_SCHEME_QUERYSTRING,
> 'version' => '1.0',
> 'signatureMethod' => 'HMAC-SHA1',
> 'consumerKey' => 'trad****.com',
> 'consumerSecret' => 'nC9P/k**************',
> );
> $consumer = new Zend_OAuth_Consumer($options);
> if (!isset($_SESSION['ACCESS_TOKEN'])) {
> if (!empty($_GET)) {
> $token = $consumer->getAccessToken($_GET, unserialize($_SESSION
> ['REQUEST_TOKEN']));
> $_SESSION['ACCESS_TOKEN'] = serialize($token);
> } else {
> $token = $consumer->getRequestToken();
> $_SESSION['REQUEST_TOKEN'] = serialize($token);
> $consumer->redirect();
> }} else {
>
> $token = unserialize($_SESSION['ACCESS_TOKEN']);
> $_SESSION['ACCESS_TOKEN'] = null;
>
> }
With 2 legged OAuth you don't need to fetch any tokens. See my
previous
example. Just setup the consumer (as you've done), sign the request,
and finally, make the request:
// Proceed to query the Contacts Data API
$contact = new Zend_Gdata($client);
$query = new Zend_Gdata_Query('http://www.google.com/m8/feeds/contacts/
default/full');
$feed = $contact->getFeed($query);
>
> I've the below exception message:
> ........Could not retrieve a valid Token response from Token
> URL.......
>
> Could you help me configuring a two-legged consumer ?
>
> Thanks in advance, Lluís
>
> On 12 nov, 19:24, Trevor Johns <[EMAIL PROTECTED]> wrote:
>
> > On Wed, Nov 12, 2008 at 9:19 AM, Eric (Google) <[EMAIL PROTECTED]> wrote:
>
> > > Yes, the Google Data APIs have components in the Zend Framework,
> > > but I haven't touched the new Zend/OAuth stuff.
>
> > > It's still in the incubator:
> > >http://framework.zend.com/svn/framework/standard/incubator/library/Zend/
>
> > > See the test cases for example usage:
> > >http://framework.zend.com/svn/framework/standard/incubator/tests/Zend...
>
> > > All you would need to do is setup a Consumer with your consumer secret
> > > and key.
>
> > > Eric
>
> > Keep in mind the Zend_Oauth module is still in development. In
> > particular, there's one bug that was hitting users on the Contacts API
> > group who tried to implement this:
>
> > http://framework.zend.com/issues/browse/ZF-4158
>
> > Speaking of which, you can see their work here, which might help:
>
> > http://groups.google.com/group/google-contacts-api/browse_thread/thre...
>
> > --
> > Trevor Johns
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Apps APIs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/google-apps-apis?hl=en
-~----------~----~----~----~------~----~------~--~---