try using zend frame library
On Thu, May 31, 2012 at 12:51 PM, felix-kot <[email protected]> wrote:
> i try retrieve user photos on my site from picasa, using Oauth 2.0
> authorisation.
> i try to receive access token like gmail contacts (contacts i retrieve
> success)
> my code on PHP:
>
> require_once LIB_PATH . '/google/src/apiClient.php';
>
> $client = new apiClient();
> $client->setApplicationName('Google Contacts PHP Sample');
> $client->setScopes("https://picasaweb.google.com/data/");
> $client->setClientId('IIIIIIDDDDDDD');
> $client->setClientSecret('SSSSSSSSS');
> $client->setRedirectUri('http://mysite/oauth');
>
> if (!isset($_GET['code'])) {
>
> // clear accessToken
> if (isset($_SESSION['token']) && !
> empty($_SESSION['token'])) {
> $client->revokeToken($_SESSION['token']);
> }
>
> // get link for authentication
> $this->_redirect($client->createAuthUrl());
> }
>
> if (!isset($_SESSION['token']) || empty($_SESSION['token'])) {
> $client->authenticate();
>
> $_SESSION['token'] = $client->getAccessToken();
> }
>
> $token = new Zend_Oauth_Token_Access();
>
> $token->setToken($_SESSION['token']);
> $token->setTokenSecret('SSSSSSSSSS');
>
> $oauthOptions = array(
> 'requestScheme' =>
> Zend_Oauth::REQUEST_SCHEME_HEADER,
> 'version' => '2.0',
> 'consumerKey' => 'KKKKKKKK',
> 'consumerSecret' => 'SSSSSSSSSS',
> 'signatureMethod' => 'HMAC-SHA1',
> 'callbackUrl' => 'http://mysite/import/picasa',
> 'requestTokenUrl' => 'https://accounts.google.com/o/
> oauth2/auth',
> 'accessTokenUrl' => 'https://accounts.google.com/o/
> oauth2/token'
> );
>
> $httpClient = $token->getHttpClient($oauthOptions);
>
> $service = new Zend_Gdata_Photos($httpClient);
>
> $userFeed = $service->getUserFeed("default");
>
> die(var_dump($userFeed));
>
> and picasa response:
>
> Token invalid - Invalid token: Cannot parse AuthSub token:
> {"access_token":"ya29.AHES6ZRKBoyeNd0IQQEq4dVRuFyR3iOup-
>
> nK_SkLGsh41w","token_type":"Bearer","expires_in":
> 3600,"refresh_token":"1\/
> FfABe3mkkPwvAJEdxIckwNAOOfgEORS-1bG_p5zAlyY","created":
> 1337962339}"
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Picasa Web Albums API" 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-picasa-data-api?hl=en.
>
>
--
Shesha kiran | Software Engineer | [email protected] | 9291541131
--
You received this message because you are subscribed to the Google Groups
"Google Picasa Web Albums API" 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-picasa-data-api?hl=en.