Search code examples
javascriptnode.jsapioauth-2.0pocket

Pocket API fails when re-trying to authorize user


I have the following issue with the Pocket API in a Web app:

  • At first the login flow works correctly and I can make authenticated calls.
  • If the user reloads the page, when re-trying to authorize I get the following message:

enter image description here

  • If I restart the server the authorization works once again (and fails after the first time). This makes me think that I'm not storing the authorization state correctly, but I could not find any information regarding this in the docs.

My app is written using Express on Node.js. The code is available here, the components of interest being the server entry-point and the Pocket API endpoints.


Solution

  • Seems the issue was indeed not re-using the user access token; I now save it in a cookie and check for that before trying to re-authorize and everything seems to work OK (see pull request).