Search code examples
javascriptoauthoauth-2.0stocktwits

How can I authenticate my calls to the StockTwits API?


I'm building a StockTwits app in Javascript.

I'm looking at the API documentation on OAuth http://stocktwits.com/developers/docs/authentication but confused about how to complete the client-side OAuth flow.

How can I properly authenticate my calls to StockTwits in javascript?


Solution

  • Please see the "Client side OAuth flow" on the Authentication page.

    Once you have a consumer key and consumer secret from registering an app with us, call the authorize end-point with your details:

    https://api.stocktwits.com/api/2/oauth/authorize?client_id=<client_id>&response_type=token&redirect_uri=http://www.example.com&scope=read,watch_lists,publish_messages,publish_watch_lists,follow_users,follow_stocks
    

    Once you or the user authorizes the application from the authentication box, the access token will be passed as a hash in the redirect URI you provided in the authorize call.

    Let us know the responses you're getting if it's still not working.