If one uses @me, then they need to include the xoauth_requestor_id in the query 
string (which would be a real user ID). That should work.

 

 

 

From: opensocial-api@googlegroups.com [mailto:opensocial-...@googlegroups.com] 
On Behalf Of Chris Chabot
Sent: Monday, July 20, 2009 3:02 AM
To: opensocial-api@googlegroups.com
Subject: [OpenSocial] Re: Permission denied while accessing activities through 
client libraries

 

Hey Abhishek,

I'm affraid that Orkut doesn't support fetching and creating activities through 
their RESTful API's, so the error your getting is not due to your code (though 
I admit it's a confusing error message)

Oh and another thing to note is that you're using 2 legged OAuth, which means 
you are making requests on behalf of an application (which the user you are 
querying has to have installed to have access to that data), and there's no 
user associated with the authentication; As such using @me / @self can't work 
since @me doesn't resolve to a user id. Please use a real user id ('123545') 
instead.

The difference between 2 and 3 legged OAuth is that with the 3 legged variant, 
the user is redirected to the providers site and asked to login & grant 
permission to his/her data (at which point that access key is associated with a 
user id and @me resolves to the user who granted access), the 2 legged variant 
skips that step (so no redirection in the browser which is cool), and the 
authentication is purely based on the application you registered with the 
provider (orkut in this case) and the consumer key and token that were assigned 
to you when you registered the app. Because there's no "user granting access" 
step, the calls have access to everything the application has access too (ie: 
the users that have installed that gadget), and because there's no user 
associated, @me doesn't resolve to a user id

    -- Chris

On Mon, Jul 20, 2009 at 10:17 AM, abhishek <abhinow.abhis...@gmail.com> wrote:


Im trying to access my and my friends' activities through php client
libraries. Im getting error 401.

unauthorized: Get activity permission denied

$provider = new osapiOrkutProvider();
$auth = new osapiOAuth2Legged("OAuth Consumer Key", "OAuth Consumer
Secret");
$osapi = new osapi($provider, $auth);

$user_params = array(
     'userId' => '@me',
     'groupId' => '@self',
     'count' => 10
 );

$batch->add($osapi->activities->get($user_params), 'userActivities');
$result = $batch->execute();

please help me with this





--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"OpenSocial Application Development" group.
To post to this group, send email to opensocial-api@googlegroups.com
To unsubscribe from this group, send email to 
opensocial-api+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/opensocial-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to