0

I am trying to create a javascript application and connect to the Etrade API. Interestingly, I succeeded at the harder stuff like Oauth and received my access token and secret, however when I try to access the actual data I get an 'unauthorized access - consumerkey is missing error'. The same code/workflow worked for all the preceding steps so I am confused as why it doesn't work here and Etrade staff don't seem particularly interested in helping.

my code is as follows, thanks for any help. (this is using appcelerator but I don't think that's particularly relevant to the issue)

var step4 = Ti.Network.createHTTPClient();
var step4url = "https://etwssandbox.etrade.com/accounts/sandbox/rest/accountlist?oauth_consumer_key="+consumerKey+"&oauth_token="+accesstoken+"&oauth_nonce="+auth_parameters.oauth_nonce + "&oauth_signature_method=HMAC-SHA1&oauth_timestamp=" + auth_parameters.oauth_timestamp+"&oauth_signature="+authSignature;

step4.setRequestHeader('Authorization', 'OAuth oauth_consumer_key="' + consumerKey + '",oauth_timestamp="'+auth_parameters.oauth_timestamp+'",oauth_nonce="'+auth_parameters.oauth_nonce+'",oauth_signature_method="HMAC-SHA1",oauth_signature="'+authSignature+'",oauth_token="'+accesstoken+'"');

step4.open("GET", step4url);
step4.send();
SeanO
  • 1
  • 1

1 Answers1

0

Figured it out, it was cookie related. The ETRADE Cookie header being set during the verification code step was interfering with subsequent API calls. Maybe this helps someone in the future.

SeanO
  • 1
  • 1