Skip to content
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

Google Drive API V3 - Login required 401 Error #92

Open
vinhnguyenlastmileworks opened this issue May 28, 2021 · 5 comments
Open

Google Drive API V3 - Login required 401 Error #92

vinhnguyenlastmileworks opened this issue May 28, 2021 · 5 comments

Comments

@vinhnguyenlastmileworks

I was to connect my web app written in Laravel to connect with google drive. I use Flysystem Adapter.
Unfortunately After a period of use. it is showing 401 error? I have added client id, client secret , refersh token and folder id.

Google_Service_Exception { "error": { "errors": [ { "domain": "global", "reason": "required", "message": "Login Required", "locationType": "header", "location": "Authorization" } ], "code": 401, "message": "Login Required" } }

I tried redoing the whole configuration on my account, but it doesn't seem to change anything.
can someone help me?

Thank all so much.

@PaolaRuby
Copy link

PaolaRuby commented May 28, 2021

After a period of use

That means period of use on a long time executing script? because after 60 min needs a refresh I suppose

If you re-generate a valid token acording getting-your-refresh-token, maybe has a security config on google, also try another package to discard this package, masbug/flysystem-google-drive-ext have the same config

@rafatriolo
Copy link

Hi there, I´ve followed these steps and so for so good. But after like 4 or 5 days this error : Google_Service_Exception { "error": { "errors": [ { "domain": "global", "reason": "required", "message": "Login Required", "locationType": "header", "location": "Authorization" } ], "code": 401, "message": "Login Required" } } keeps showing, and I have to go through the refresh token again. Is there a more permanent solution.

Tks and best regards.

@raktim135
Copy link

I have also faced the same issue in Laravel app and successfully solved it. Follow the steps below:

  1. Add GOOGLE_DRIVE_FOLDER_ID to .env and assign the value from your Google Console
  2. In app/filesystems.php, add 'accessToken' => env('GOOGLE_DRIVE_ACCESS_TOKEN'), to google drive config array.
  3. In GoolgeDriveServiceProvider.php set $client->setAccessToken($config['accessToken']);
  4. Test Now. Enjoy

@PaolaRuby
Copy link

PaolaRuby commented Dec 27, 2021

@raktim135 maybe this package needs a PR like this masbug/flysystem-google-drive-ext#34,

Follow Google Docs to obtain your ClientId, ClientSecret & refreshToken in addition you can also check this easy-to-follow tutorial

also how you get the access token?

@hassanshahzadaheer
Copy link

I have also faced the same issue in Laravel app and successfully solved it. Follow the steps below:

  1. Add GOOGLE_DRIVE_FOLDER_ID to .env and assign the value from your Google Console
  2. In app/filesystems.php, add 'accessToken' => env('GOOGLE_DRIVE_ACCESS_TOKEN'), to google drive config array.
  3. In GoolgeDriveServiceProvider.php set $client->setAccessToken($config['accessToken']);
  4. Test Now. Enjoy

thank you so much dear 👍🏽

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants