erikbrinkman / rmapi-js

JavaScript implementation of the reMarkable api
https://erikbrinkman.github.io/rmapi-js/modules.html
MIT License
9 stars 1 forks source link

Couldn't fetch auth token: Too Many Requests #7

Closed Bartek532 closed 11 months ago

Bartek532 commented 11 months ago

Sometimes I'm receiving error couldn't fetch auth token: Too Many Requests when I'm interacting with an API. Is there some limit from reMarkable or is it library bug?

Thanks in advance!

erikbrinkman commented 11 months ago

The reMarkable API isn't public, so nothing is guaranteed. This library was cobbled together with other documentation. It seems like reMarkable is enforcing a rate limit for fetching auth tokens.

I'm not sure exactly where this is happening, but general you should be following the example:

const code = "..."  // eight letter code from https://my.remarkable.com/device/desktop/connect
const token = await register(code)
// persist this token locally, you should never need it again
const api = await remarkable(token);
// now use this api object repeatedly, don't create a new object for each request

If you follow that, you should be fine. If you're still running into this, I would try to persist the api object longer.

Since I don't really have control over what reMarkable does, I'm going to close this out, but feel free to reopen if you're still running into this, and want other ideas for how to mitigate it. If you do reopen it, try to give more context around what you're doing, otherwise there's not much that I can do. Note, for your own privacy, don't post the authentication token.