flysystem-google-drive icon indicating copy to clipboard operation
flysystem-google-drive copied to clipboard

Invalid Credentials (refresh token not working)

Open foremtehan opened this issue 3 years ago • 11 comments

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 :

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "authError",
    "message": "Invalid Credentials",
    "locationType": "header",
    "location": "Authorization"
   }
  ],
  "code": 401,
  "message": "Invalid Credentials"
 }
}

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 ?

foremtehan avatar Aug 07 '21 17:08 foremtehan

can be related to https://github.com/googleapis/google-api-php-client/issues/1075 ? the access token cached by the google api package

foremtehan avatar Aug 08 '21 17:08 foremtehan

in any google drive package, you have to refresh the token after more than 60min long time script, maybe you can make a pull request to fix that

PaolaRuby avatar Aug 09 '21 17:08 PaolaRuby

any updates on this?

@foremtehan did you found any solution?

Thanks!

marcoocram avatar Sep 29 '21 15:09 marcoocram

@marcoocram here is the solution https://github.com/masbug/flysystem-google-drive-ext/issues/33

PaolaRuby avatar Sep 30 '21 00:09 PaolaRuby

Mmm is another repo and not released yet...

marcoocram avatar Sep 30 '21 06:09 marcoocram

@marcoocram another repo but with the same config, just use dev branch

composer require masbug/flysystem-google-drive-ext:"1.x@dev"

PaolaRuby avatar Sep 30 '21 13:09 PaolaRuby

maybe the source is the solution....

related: https://github.com/googleapis/google-api-php-client/pull/2134

marcoocram avatar Sep 30 '21 13:09 marcoocram

@marcoocram that would be better since this package has not been supported since 29 Jul 2020

PaolaRuby avatar Sep 30 '21 22:09 PaolaRuby

googleapis/google-api-php-client#2134 @marcoocram another solution?

PaolaRuby avatar Jan 07 '22 22:01 PaolaRuby

Use my solution wrapping the code...

marcoocram avatar Jan 07 '22 23:01 marcoocram

It was cache issue for me.

lovecoding-git avatar Apr 10 '23 21:04 lovecoding-git