Reputation: 3992
I subscribe to file notifications via Push Notification API:
https://developers.google.com/drive/api/v3/push
And after the subscription I immediately try to edit the file - notification will be sent.
But, I try to edit file 1 hour later - and notification will not be sent.
Why is this happening? Is this related to the expire time of the user access-token? (access token can live only one hour)
Upvotes: 0
Views: 320
Reputation: 5253
The official documentation states the following:
Note: For the Drive API, the maximum expiration time is 86400 seconds (1 day) after the current time for File resources and 604800 seconds (1 week) for Changes. If you don’t set the expiration property in your request, the expiration time defaults to 3600 seconds after the current time.
That means you are not setting an expiration time when sending the watch request, hence you need to refresh the watch every hour. To avoid refreshing it every hour, include an expiration time in your watch request and then refresh it as per the instructions here.
Upvotes: 1