Monica Muranyi
Monica Muranyi

Reputation: 131

Simulate expiration of sync token when calling Google Calendar API

From the documentation (https://developers.google.com/google-apps/calendar/v3/sync):

Sometimes sync tokens are invalidated by the server, for various reasons including token expiration or changes in related ACLs. In such cases, the server will respond to an incremental request with a response code 410. This should trigger a full wipe of the client’s store and a new full sync.

I need to simulate the 410 error. Is there a way to set the sync token expiration date? I tried changing the access control data of the calendar but the sync token is not invalidated.

Upvotes: 1

Views: 1549

Answers (1)

Minto Tsai
Minto Tsai

Reputation: 161

I recently needed to test the 410 response scenario in my code. In my case it turned out to be really simple to trigger the 410 response.

I store the sync token in the database, which looks something like "CIiV7urvy84CEIiV7urvy84CGAU=".

I was able to change the sync token to trigger the 410 response. I changed to "1CIiV7urvy84CEIiV7urvy84CGAU=", adding a "1" at the beginning.

Upvotes: 9

Related Questions