When I try to get access token from Google API but I get null
$client = new Google_Client(); $client->setApplicationName("name app"); $client->setAccessType('offline'); $client->setClientId('id client'); $client->setClientSecret('secret'); $client->setRedirectUri('redirect url'); $client->addScope("https://www.googleapis.com/auth/calendar.readonly"); //$client->authenticate($_GET['code']); $access_token = $client->getAccessToken(); $tokens_decoded = json_decode($access_token); //$refreshToken = $tokens_decoded->refresh_token; if(!$access_token) { /** * AUCUN TOKEN SAUVE -> IL FAUT REDIRIGER * L'UTILISATEUR SUR L'URL $authUrl */ $authUrl = $client->createAuthUrl(); die(); } Please suggest a way to get the same