title: How to get "Sign in with Twitter" working with NodeJS
body: <p>Im trying to implement Sing In with Twitter working, however i keep getting the following error</p>
  
  <blockquote>
    <p>Whoa there!
    The request token for this page is invalid. It may have already been used, or expired because it is too old. Please go back to the site or application that sent you here and try again; it was probably just a mistake.</p>
  </blockquote>
  
  <p>Here's my code, the what am I doing wrong?</p>
  
  <pre><code>// Server
  var OAuth = require('oauth').OAuth;
  var callbackUrl = null;
  var oa = new OAuth(
      'https://api.twitter.com/oauth/request_token',
      'https://api.twitter.com/oauth/access_token',
      CONSUMER_KEY,
      CONSUMER_SECRET,
      '1.0',
      callbackUrl,
      'HMAC-SHA1'
  );
  
  const promise = new Promise((resolve, reject) =&gt; {
      oa.getOAuthRequestToken(function(error, token, secret, results) {
          resolve({
              token,
              secret,
          });
      });
  });
  
  var oauth = await promise;
  return { oauth };
  
  // Client
  window.open(`https://api.twitter.com/oauth/authenticate?oauth_token=${twitter.oauth.token})`);
  </code></pre>
  
  <p>I've also set the callback url to the same as what I have in the app details page, but no dice!</p>
  
  <pre><code>var callbackUrl = 'http://0.0.0.0:3001/settings/social/twitter/oauth';
  </code></pre>
  
  <p>Small note, not sure if it helps, but I've noticed the returned tokens are shorter than the examples I've seen online. Example: </p>
  
  <pre><code>Mine: EBhy3AAAAAAA94TPAAABajDwCww%
  Twitter Site: NPcudxy0yU5T3tBzho7iCotZ3cnetKwcTIRlX0iwRl0&amp;
  </code></pre>