dacastro4 / laravel-gmail

Laravel wrapper for the Gmail API
MIT License
289 stars 133 forks source link

How I can automatically Login #158

Open kvachakhia opened 4 years ago

kvachakhia commented 4 years ago

I have Cron task: after 10 min fetch mails but how yo auth to my Gmail any idea? @dacastro4

mbasfour commented 3 years ago

The same request, I am using the package to allow sending emails using the Gmail API, So I am authenticating using the backend and need a way to renew the token if it's expired or to generate a non-expiring token.

afagard commented 3 years ago

This package will automatically renew the token once you login once. I simply login via http once to authenticate the script. Just follow the examples to get thing going.

For CRON, I have found that you need to have allow_multiple_credentials set to false otherwise it looks for the current user's id, and when in cron, that isn't available.

I am happy to say that I've successfully got a CRON job running with this script after a lot of trial and error.