40104: Token request timestamp outside permitted window

token_request_timestamp_outside_permitted_window

The timestamp in a token request fell outside the window Ably accepts, so the request was rejected. This usually happens when the clock of the system that generated the token request differs significantly from real time.

What you should do

Make sure the system generating token requests has an accurate clock, since the fix is almost always clock synchronization. If you can't rely on the clock, set the queryTime client option to true so the SDK uses Ably's server time when creating token requests. Also make sure each token request is generated fresh rather than cached past the point its timestamp is still current.

Why it happens

The timestamp in a token request was too far from Ably's current time to be accepted. This is usually a clock on the token-generating system that has drifted from real time, or a token request that was cached and reused after its timestamp went stale.

What you'll see

The error is reported with code 40104 and HTTP status 401. The message is Timestamp not current.