I am trying to get refresh token for the authentication using Google_Client
class. Here's how I am trying to do.
using package "google/apiclient": "^2.2",
$client = new \Google_Client($config);
$client->setAccessType("offline");
$client->setState('offline');
$client->setApprovalPrompt('force');
$client->setIncludeGrantedScopes(true);
var_dump($client->authenticate('<auth_token_goes_here>');); // dumps array which has id_token, access_token , expires_in, token_type & created
var_dump($googleClient->getAccessToken()); // dumps array which has id_token, access_token , expires_in, token_type & created
var_dump($googleClient->getRefreshToken()); // returns null
What's wrong here?