pythonpython-requestsstocktwits

Error: invalid_client unknown client for a simple POST request


I'm trying to access the API for Stocktwits and get the above error when I post a request to the server. Below is my code:

data = [
  ('client_id', '<client id>'),
  ('response_type', 'code'),
  ('redirect_uri', 'http://example.com'),
  ('scope', 'read,watch_lists,publish_messages,publish_watch_lists,follow_users,follow_stocks')
]

d = requests.post('https://api.stocktwits.com/api/2/oauth/authorize', data=data)
print d.text

Does anyone know why this might be happening? The client_id is what I got after registering my app domain with Stocktwits.


Solution

  • The only way this error would come back to you is if you are sending in a client_id that doesn't exist. Not much help to be given here, you just have to be sure the client_id is the correct one that is given to you after registering a StockTwits app.