Close this search box.

Dealing with expired Access Tokens

General Information

If there is no traffic to a website at all for longer than a month you may see the following error: “ApiException Thrown: ERROR: The Token has expired on YYYY-MM-DD”.

This occurs because of a combination of how we authenticate your requests to our API, and how WordPress works internally. If this error occurs for you on a private Staging site but you have a Production site with a working installation of MegaCalendar, you can simply go to MegaCal > Settings > Advanced, click on the “Show Access Tokens” button, and copy your access tokens into your Staging site.

If you have encountered this issue and do not have a working Production installation of MegaCalendar, or if you have any other issues please reach out to us via email and we can send you a valid token and walk you through how to resolve the issue.

Developer Information

In order to provide integration without a username and password, MegaCalendar uses a multi-key authentication system. This means that you have one permanent secret key which is used in tandem with a temporary secret key in order to make requests to our API. Only a non-expired temporary key used with your permanent key will be allowed to access your data. Our plugin needs to regularly refresh your temporary key when it expires, and in order to do so it must make a request to the API. If a site has no visitors during the window for refresh no requests will be able to be sent and your key will expire.

Unfortunately, because WP Cron also does not fire unless a site has active visitors, we have no way to resolve this internally within the plugin itself. If you have a use-case where this is occurring to you, the simplest approach to resolve this is currently to register a real cron task which uses cURL or a similar method to send a GET request to

Different web hosts allow different levels of access, and how you register a cron task will depend on a number of factors. Reaching out to your hosting provider is a good place to start.