googleapis / google-api-php-client

A PHP client library for accessing Google APIs
http://googleapis.github.io/google-api-php-client/
Apache License 2.0
9.32k stars 3.52k forks source link

refresh token is not in the response #2489

Closed rabol closed 1 year ago

rabol commented 1 year ago

Code example

[google-api-php-client](https://github.com/googleapis/google-api-php-client/tree/main)/[examples](https://github.com/googleapis/google-api-php-client/tree/main/examples)
/simple-file-upload.php

Return:

'access_token' => 'ya29.a0AfB_byDnhLDwa2MlY9GPus6tJR4jihoKayRqo_sUQrrwXIm6Iot98nSHU-9cCeVuKrtWSX9Brb6BtuQ6TT3reKq6PXG3xmRlAqCkZxzqFmPJhbKKGmhLaHKXxyeAwdNFjHxwj1cpE2p4kJpaNJyHTr-mgFZfYtaKuD3HyFoaCgYKAdESARESFQHsvYls1NqPYF03Rn6M6yS2YKpFFw0174',
  'expires_in' => 3599,
  'scope' => 'https://www.googleapis.com/auth/drive https://www.googleapis.com/auth/drive.file',
  'token_type' => 'Bearer',
  'created' => 1692783229,

the

rabol commented 1 year ago

NOTE: If one request access to a users Google drive and do not get the refresh token the first time one will never get the token. If the 'user in question' then goes and delete the permission here:

https://myaccount.google.com/connections

and your app the asks for permission again, then you might get lucky and get the refresh token