randomBrainstormer / MMM-GoogleCalendar

Google Calendar for MagicMirror²
MIT License
69 stars 46 forks source link

Consistent Invalid grant, aprox every week #65

Open SupaCoder opened 5 months ago

SupaCoder commented 5 months ago

Have the module installed and configured, works as it should for about a week, after which it shows invalid grant, the only fix i have found so far is to stop MM, delete tocken, run auth script, start MM back up.

Because this is running on an older Pi2 this process can take upwards of 10min each time as i have to wait for the google auth pages to load.

Is this an issue with the module or something in my settings?

randomBrainstormer commented 5 months ago

Hi @SupaCoder ,

It sounds like you've done everything correctly with setting up the module. The issue with the expired token is a common one in projects that utilize Google authentication. Typically, when your app is in "test" mode in the Google Cloud Platform, tokens have a limited lifespan and tend to expire every seven days or so.

To mitigate this problem, you need to change the status of your app from "testing" to "production" by publishing it. Here's how you can do that:

  1. Go to your Google Cloud Project console.
  2. Click on the "OAuth consent screen" tab.
  3. Scroll down to the "Publishing Status" section.
  4. There should be an option to "Publish App." Click this button.
  5. A prompt will appear, asking you to review the permissions and other necessary details. Make sure everything is correct and submit for publishing.

Once your app is published, the token's lifespan should be significantly extended, which will lessen the frequency of these disruptions needing a new authorization.

Best regards, Ivan

unknownuser17769 commented 5 months ago

Doesn't this make your calendar public and accessible to anyone with a Google account?

randomBrainstormer commented 4 months ago

Hi @unknownuser17769, "Pubishing App" should only affect your google engine app, not your calendar. Since you're the only one authenticating to your CGP app from the MMM-GooogleCalendar instance, you're calendar info stays private, and visible only throuhg your MagicMirror instance. If anybody else were to attempt to authenticate within your app, they would need access to your cgp app, MagicMirror instance, and calendar settings. However, in this case, your data remains private since you're the only one authenticating against your own app, and the OAuth credentials are used solely within your instance of the plugin. As a result, there's no public exposure to worry about.