Access_token is authorizing but subsequent calls reset to the owner of the clientid

76 Views Asked by At

When I create an access_token from a code value. It works perfectly the first time and all is well - but subsequent calls will reset to the owner (myself) of the client_id. The docs say the token doesn't expire, but it appears to fail later and when I go to generate a new token it is indeed resetting to my account.

https://api.stocktwits.com/developers/docs/authentication

"You may want to store this access token; this access token will not refresh, so you can use it indefinitely on behalf of the authenticated user."

This not true - I see the token fail when using it later.

1

There are 1 best solutions below

0
On

Follow up answer to this... given the API leaves much to be desired from omitted or outdated fields to abandoned routines like the refresh_token.

While the X-RateLimit-Remaining is documented what is not is if you allow it to run to 0 and then stop. If you do, it will kill the token and then subsequent calls to reauthorize the token will actually change the user when granting a new token. This appears to be because the code method, which I use as recommended - will become invalidated yet issue a token for the owner of the client_id or perhaps it was trying to make a link and I had 3 devices at my location and it was matching based off of IP - who knows.

My solution was to cut the calls between 5-8 requests before hitting the limit. Then resume after the time recommended by the X-RateLimit-Reset