Yii 1.1: googleapis

Enables any app to access Google APIs through Oauth2 (including 2-legged auth for Google Marketplace)

This extensions provides a wrapper to googles google-api-php-client library providing an easy way to access google apis and authentication via 2- or 3-legged auth mechanisms. The extension is intended to enable any app to access google apis, perform authentication and get listed on google marketplace.


Yii 1.1 or above


Copy the GoogleApis folder into extensions.


'components' => array(
        // ...
        'GoogleApis' => array(
            'class' => 'ext.GoogleApis.GoogleApis',
            // See http://code.google.com/p/google-api-php-client/wiki/OAuth2
            'clientId' => 'YOUR_CLIENT_ID',
            'clientSecret' => 'YOUR_CLIENT_SECRET',
            'redirectUri' => 'YOUR_REDIRECT_URI',
            // // This is the API key for 'Simple API Access'
            'developerKey' => 'YOUR_DEVELOPER_KEY',
        // ...


* @var apiPlusService $service
$plus = Yii::app()->GoogleApis->serviceFactory('Plus');
* @var apiClient $client
$client = Yii::app()->GoogleApis->client;
Try {
  || is_null(Yii::app()->session['auth_token']))
    // You want to use a persistence layer like the DB for storing this along
    // with the current user
    Yii::app()->session['auth_token'] = $client->authenticate();
    $activities = '';
    $activities = $plus->activities->listActivities('me', 'public');
    print 'Your Activities: <pre>' . print_r($activities, true) . '</pre>';
} catch(Exception $e) {
    // This needs some love as not every exception means that the token
    // was invalidated
    Yii::app()->session['auth_token'] = null;
    throw $e;


Test and provide samples for Google Marketplace (2-legged-auth).


Total 6 comments

#18762 report it
hajdar at 2014/12/31 05:14am
apiAuthException Could not json decode the access token

Error: apiAuthException Could not json decode the access token

#15128 report it
Shahcheraghean at 2013/10/10 03:05am
form api

Thank you for the extension. How can i use form api in the extension?

#11113 report it
Daniel Khan at 2012/12/17 03:34pm

I need to look into it.

#11112 report it
Daniel Khan at 2012/12/17 03:30pm

Thank you.

#10929 report it
radoo at 2012/12/04 05:04am
acccess to docs on google drive

Any chance I could use this ext to read-write docs on google drive?

#10903 report it
docnewman at 2012/12/01 11:49pm

I believe you need a $client->setAccessToken(Yii::app()->session['auth_token']);

inside the else block

Leave a comment

Please to leave your comment.

Create extension