Google PHP API Offline Access Issue
===

I am trying to use Google PHP API to sream contents from Google plus. I was able to get the refresh token. Byt when I tried to get access token using that refresh token its returning the following error.

Fatal error: Uncaught exception 'apiAuthException' with message 'Error refreshing the OAuth2 token, message: '{ "error" : "invalid_grant" }'' in /var/www/social-media-test/google-api-php-client/src/auth/apiOAuth2.php:242 Stack trace: #0 /var/www/social-media-test/google-api-php-client/src/apiClient.php(281): apiOAuth2->refreshToken('MY-REFRESH-TOKEN-HERE') #1 /var/www/social-media-test/google-api-php-client/examples/plus/p.php(19): apiClient->refreshToken('MY-REFRESH-TOKEN-HERE') #2 {main} thrown in /var/www/social-media-test/google-api-php-client/src/auth/apiOAuth2.php on line 242

MY code is as shown below.

    $client = new apiClient();
    $client->setApplicationName('Google+ PHP Starter Application');
    $client->setClientId('client-id');
    $client->setClientSecret('secret-key');
    $client->setRedirectUri('http://localhost/index.php/main');
    $client->setDeveloperKey('dev-key');
    $plus = new apiPlusService($client);

    $client->refreshToken('MY-REFRESH-TOKEN');

Any Ideas? 