Search code examples
stocktwits

Captcha response while retrieving access_token


I'm now testing custom sharing flow in StockTwits and got stuck on authorizing the user. I'm following the server-side oauth flow described here.

I'm using an npm lib stocktwits, but I've already tried this request from terminal using curl: curl -X POST https://api.stocktwits.com/api/2/oauth/token -d 'client_id=439fb********3e6&client_secret=5420fa774******970c24f074b90e617&code=ccb99afde1**********de6d782029c68&grant_type=authorization_code'

After getting the code I call the https://api.stocktwits.com/api/2/oauth/token (POST) to perform exchange for access_token but I get an unexpected response with HTML in it asking to bypass a captcha instead of JSON like described in here.


Solution

  • I didn't solve the issue with server side flow. My purpose was to authorize in any possible way, so I just switched from server-side flow to client side and it works just fine. both approaches are described here