0

I have been following the dated and limited documentation on the E*Trade developer site and with help from some other stack overflow posts.

I am pretty certain that I have retrieved a good access token and secret. I have been following their snippets

request = new ClientRequest(); // Instantiate ClientRequest
request.setEnv(Environment.SANDBOX); // Use sandbox environment
request.setConsumerKey(oauth_consumer_key); // Set consumer key
request.setConsumerSecret(oauth_consumer_secret); // Set consumer secret
request.setToken(oauth_access_token);
request.setTokenSecret(oauth_access_token_secret);
AccountsClient account_client = new AccountsClient(request);

I also tried with:

MarketClient client = new MarketClient(request);
ArrayList<String> list = new ArrayList<>();
list.add("AAPL");
QuoteResponse response = client.getQuote(list, Boolean.FALSE, DetailFlag.ALL);

In all case, it returns a 401 code and a message of <Error> message>Unauthorized request</message></Error>

Is this something on the E-Trade end? Or something with my implementation of their snippets? I have reached out to E-Trade but thought I'd post here with the hope of a resolution.

Bryan
  • 295
  • 1
  • 2
  • 9
  • Are you using v0 or v1? v0 was sunset on 12/31/2018. – ordonezalex Jan 31 '19 at 23:25
  • Thanks @ordonezalex, afaik it's v1 - I followed the info on their site a few weeks ago. I actually looked at some python code as well. One app didn't work but then I found a sample ETrade app that did. I then found they posted a java sample app this week that seems quite detailed. I am going to try that and see what happens. I did notice that they updated a lot of the dependencies and also added spring. – Bryan Feb 01 '19 at 04:43
  • I would definitely follow through with the demo app they provided. I looked through it and didn't see any `ClientRequest` or `MarketClient` like you have in your code, but they probably provide equivalent functionality in the demo. – ordonezalex Feb 01 '19 at 06:10
  • Well, we'll see where this goes. The sdk I downloaded earlier this week is indeed V0. Changing the URL the code hits returns a 200 status response. The app just downloaded fails trying to fetch a request token. It is sending the OAUTH settings in the query parameters - whereas the documentation says it should be the header. Looking to see if I can get this newer code working. – Bryan Feb 01 '19 at 18:47

0 Answers0