oauth 2.0 - Refresh token must be passed in or set as part of setAccessToken Youtube API -


i have following code

if (file_exists($credentialspath)) {      $accesstoken = file_get_contents($credentialspath);      $client->setaccesstoken($accesstoken);      if ($client->isaccesstokenexpired()) {         $client->fetchaccesstokenwithrefreshtoken($client->getrefreshtoken());         $newaccesstoken = $client->getaccesstoken();         $accesstoken = array_merge($accesstoken, $newaccesstoken);         file_put_contents($credentialspath, json_encode($accesstoken));     } }  

but after hour, if try use youtube data api, getting following error,

fatal error: uncaught exception 'logicexception' message 'refresh token must passed in or set part of setaccesstoken' in /var/sentora/hostdata/zadmin/public_html/classes/library/youtube/vendor/google/apiclient/src/google/client.php:267 stack trace: #0 /var/sentora/hostdata/zadmin/public_html/classes/library/youtube/youtube.php(26): google_client->fetchaccesstokenwithrefreshtoken(null) #1 /var/sentora/hostdata/zadmin/public_html/channel/apiwrap.php(3): require_once('/var/sentora/ho...') #2 {main} thrown in /var/sentora/hostdata/zadmin/public_html/classes/library/youtube/vendor/google/apiclient/src/google/client.php on line 267 

please help.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -