So I have integrated with the API and our auth header generator works perfect. We can twee, favorite, message, re-tweet perfectly using the tokens we have in our DB. I am now adding a “sign in with twitter” functionality. I have added a call to /oauth/request_token. The ONLY thing different between this and everything else that already works:
if(token){ oauthQuery.addItem(new KeyValuePair(“oauth_token”, token));}
Basically if we don’t already have a token (like when calling request_token) it doesn’t get added as a header. and:
var keyString:String = encodeURIComponent(CONSUMER_SECRET) + “&”;
if (secret) { keyString += encodeURIComponent(secret);}
Our token secret doesn’t exist yet so it is not added as part of the signing key.
We have a callback url set on the app in twitter (although it will be deprecated) and I am passing in the oath_callback into the header generation process as well so it is added to the header and included in the signing process. I even tried adding to the header but EXCLUDING it from the signature generation process but that wasn’t the answer.
here is the header I generate:
Authorization: OAuth oauth_callback=“http%3A%2F%2Fwww.qubeey.com%2Ftwitter”, oauth_consumer_key=“oDiUd2FZt5MozB2ocgvH1w”, oauth_nonce=“3833BEA2-44A6-550B-DFA7-9F57A52F4948”, oauth_signature=“JLphDUh3Xpdzz%2BhkMMVpJcLQMVw%3D”, oauth_signature_method=“HMAC-SHA1”, oauth_timestamp=“1355588020”, oauth_version=“1.0”
Again, our auth code works on EVERY API call in twitter except when calling request_token. Any ideas?
EDIT: The exact message in the 401 is “Failed to validate oauth signature and token”