Sign in with Stocktwits


Simplify your registration and sign-in process by using a "Connect with Stocktwits" button.

This lets your user know that they can register for your app with one click using their Stocktwits account. It also grants your app access to their account and gives you the ability to post messages and access their profile details. As mentioned in the Authentication documentation, your access to users' account details will vary depending on the user permissions that are granted upon signing up.

Implementing Sign in with Stocktwits

  1. Add a "Connect with Stocktwits" button to your website. You can use the button below or create one of your own that works with our site. If you create your own button, be sure to use our logos properly and adhere to our Terms and Conditions.

    Connect with Stocktwits

    Connect with Stocktwits

    Connect with Stocktwits

    Connect with Stocktwits

    Connect with Stocktwits

    Connect with Stocktwits

    Connect with Stocktwits

  2. After directing the user to the authorize call (step 2 of the Authentication flow), Stocktwits will prompt an authentication box for the user to login and grant access to your application with the permissions you request:

    Connect with Stocktwits,watch_lists,publish_messages,publish_watch_lists,direct_messages,follow_users,follow_stocks

  3. Once granted, the user will be directed back to your site (the 'redirect_uri' set in the authorize call) with a verification token passed as a query parameter named code.

  4. Send a POST request to with the code, client_id, client_secret, and redirect_uri:

  6. The response will return with an access_token, scope, user_id and username. You can then use this access token to make authenticated API calls on behalf of the user. Note that this access token will not expire or need to be refreshed, so you may want to save this access token:

      "user_id": 1,
      "access_token": "<access_token>",
      "scope": "read",
      "username": "userabc"

Client-side JavaScript Sign in

The following JavaScript code is an example of implementing the signin process on the client-side:

<script src="" type="text/javascript"></script>
<script language="javascript">

  $(document).on('click', '#connect', function() {$(this).attr('href'), 'stocktwits_oauth', 'width=500,height=550');
    return false;

  $(document).ready(function() {
    if (/access_token=(\w+)/.test(window.location.hash)) {
      var accessToken = window.location.hash.match(/access_token=(\w+)/)[1];
      $.getJSON("", { access_token: accessToken },
        function(data) {
          if (data.user) {
            $('#me').html("Hello: " + data.user.username);


<a id="connect" href="<CLIENT ID GOES HERE>&redirect_uri=<REDIRECT URL>&response_type=token">Connect to Stocktwits</a>
<div id="me"></div>