mdhom / node-red-contrib-google-oauth-calendar

2 stars 2 forks source link

Auth token expires after 7 days #6

Closed Toby-Mills closed 3 years ago

Toby-Mills commented 3 years ago

I was able to successfully get Node-Red to access and read events from my calendar (which is awesome!). One week later it stopped working, returning an error about authorisation. After editing the Google API Credentials node, and obtaining a new authentication code, it started working again. I believe it should be possible to obtain a refresh token, and have a new access token created on a regular basis without needing to edit the config node each time. Is this possible?

Toby-Mills commented 3 years ago

It looks like the refresh token was already working. The problem was just that the refresh token itself was expiring. This is because my application was still marked for 'testing'. I have now published the application, which I am hoping resolves the issue.

GED8006 commented 3 years ago

Looks like I have the same problem. After 7 days, I have an authorization problem.

@Toby-Mills How did you deploy your application? I can't see anything in Google Cloud Platform.

GED8006 commented 3 years ago

Looks like I have the same problem. After 7 days, I have an authorization problem.

@Toby-Mills How did you deploy your application? I can't see anything in Google Cloud Platform.

I found the page to switch to production mode: OAuth consent screen

Toby-Mills commented 3 years ago

Even in production mode you can have a problem. If you ask for the wrong permissions then Google will need to verify your application. Until it is verified, Google will only issue short-term tokens. Make sure you request the minimum permissions needed (I don't remember the specifics), and then Google will issue a token & refresh token that you will be able to use permanently.