-
-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid Credentials (refresh token not working) #33
Comments
@foremtehan try this branch: GoogleDriveAdapter.php, if that works i make a PR |
@erikn69 i get this exception after one hour:
|
Ok, this time i found the solution, but you have to change your config
First you have to create a google service account and get auth config json file Then change the old config for the new one ( you can look at this: GoogleDriveAdapterTests.php ) $client->setClientId($config['GOOGLE_DRIVE_CLIENT_ID']);
$client->setClientSecret($config['GOOGLE_DRIVE_CLIENT_SECRET']);
$client->refreshToken($config['GOOGLE_DRIVE_REFRESH_TOKEN']); after: (here you can add $client->setAuthConfig($config['GOOGLE_DRIVE_SERVICE_JSON']); // must be full path to json file(first step)
$client->setApplicationName($config['GOOGLE_DRIVE_SERVICE_APP_NAME'] ?? 'Your Name Application');
$client->setScopes(['https://www.googleapis.com/auth/drive']); Finally try this branch GoogleDriveAdapter.php and tell me later if works and i will make a PR |
just one thing. is service account is separated from google drive storage ? i'm seeing files successfully uploaded but cannot see them in google drive I set up a new gmail account with fresh service account, the files wouldn't store to the main drive, is there anyway that i could see the files in web ui ? |
@foremtehan last try GoogleDriveAdapter.php, forget all about $client->setClientId($config['GOOGLE_DRIVE_CLIENT_ID']);
$client->setClientSecret($config['GOOGLE_DRIVE_CLIENT_SECRET']);
$client->refreshToken($config['GOOGLE_DRIVE_REFRESH_TOKEN']); |
Ok let me try that, that service account thing looks complicated https://stackoverflow.com/questions/49663359/how-to-upload-file-to-google-drive-with-service-account-credential |
@erikn69 i didnt see any issue thanks for your time <3 |
Ok then i will do a PR for this |
I thought this issue was only happen in this repo but also happens in nao package i described it here nao-pon/flysystem-google-drive#99
When i uploading for two hours, i mean i pushed 10 jobs in laravel to upload some files in different times, the first hour is ok and after that i will get :
I did exactly what was said in this article , i checked the "auto refresh token when expired" but somehow the token will expire after an hour, should i do extra work to refresh the access token ?
The text was updated successfully, but these errors were encountered: