3

I'm trying to set up the ETrade PHP API...

In the sandbox configuration I set my ETWS_APP_KEY and ETWS_APP_SECRET with the keys ETrade Provided.

What do I set for the OAUTH information shown below? I'm confused.. do I leave these blank or where do I obtain these values?

setConst('OAUTH_ACCESS_TOKEN',      '');
setConst('OAUTH_ACCESS_TOKEN_SECRET','');
cpcdev
  • 1,130
  • 3
  • 18
  • 45

1 Answers1

1

You have the app tokens, now you need an access token for a user. The process is the same as documented on Auth Documentation

  1. Get Request Token
  2. Validate
  3. Get Access Token
  4. Access API

Here is one way to get the access token for your sandbox environment.

1) Download the Etrade SDK for PHP: SDK download

2) Execute the PHP Command line script in: ./Samples/test_etOAuth.php . You cant open it in the browser since it uses STDIN for menu responses.

3) type: 1 for "Get Token".

4) Copy the authorize URL to your browser.

5) type: n, for not opening the url in a browser off the commandline (unless you run a local php server on your desktop)

6) Enter the validation code you received in the browser onto the command line when it asks you to: "Please enter verifier code :" .

7) copy "your final authorized token" from the command line. These are the final pieces you are asking for in your question.

Now you can access the account / market information through the API.

MerlinTheMagic
  • 575
  • 5
  • 16
  • 5. type, n. you will be logging into your etrade account, then paste the link. accept the agreement. get the verifer code and put in your terminal. Then you are ready to rock and roll. Thanks @MerlinTheMagic ! – Chad May 26 '17 at 20:13
  • Also keep in mind if you use anything like test_market.php after you get connected. The information that have in there is outdated. I.E. they are will look up a "GOOG" option chain from 2015, which will obviously throw and error that isn't really documented. So change to 2018. – Chad May 26 '17 at 20:26