1

I am using google drive api with laravel for a continuous backup, so I am using following packages

"nao-pon/flysystem-google-drive": "~1.1", and

"spatie/laravel-backup": "^6.14"

I have set up google drive api v3 with refresh token and put it into .env

FILESYSTEM_CLOUD=google
GOOGLE_DRIVE_CLIENT_ID=****.apps.googleusercontent.com
GOOGLE_DRIVE_CLIENT_SECRET=****
GOOGLE_DRIVE_REFRESH_TOKEN=****
GOOGLE_DRIVE_FOLDER_ID=****

so everything works properly, and I can use google drive as a disk to store the back up everyday through a cron job, the only problem is after a week the refresh token gets expired(I assume) and stops working with this error message,

Failed to authenticate on SMTP server with username "****" using 2 possible authenticators. Authenticator LOGIN returned Expected response code 235 but got code "535", with message "535 Incorrect authentication data

if I change the refresh token again from oathplayground and place it into .env it starts working again for a week.

so how can I solve this problem thus I need not to generate the token every week.

Moshiur
  • 659
  • 6
  • 22

2 Answers2

1

Oauth playground is only intended to be used for testing. Tokens created on the playground will only work for about two weeks.

You should implement your own authorization.

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
0

It says in the OAuthPlayground that it will revoke authorization tokens after 24 hours.

Note OAuthPlayground.

The process of setting up a GCP project, consent screen and authorization is the same for all programming languages. Have a look at this answer for step by step guide to authorization.

Aerials
  • 4,231
  • 1
  • 16
  • 20
  • yes I already have the access token as that answer demonstrated, but I need the refresh token as access token has limited life time – Moshiur Mar 18 '21 at 11:28
  • https://developers.google.com/identity/protocols/oauth2/web-server#offline you can refresh your access tokens too – Aerials Mar 19 '21 at 13:15