tradestation-python-api icon indicating copy to clipboard operation
tradestation-python-api copied to clipboard

Tradestation has changed authentication from auth2 to auth0 Guardian

Open sathiyaparmar opened this issue 4 years ago • 3 comments

Tradestation has changed authentication from auth2 to auth0 Guardian. This library still uses auth2, Can you please update the authentication

sathiyaparmar avatar Dec 01 '21 14:12 sathiyaparmar

Have you worked around this issue yet?

syntaxsdev avatar Jan 02 '22 23:01 syntaxsdev

@Gabedave how is your fork coming along? Does it work?

jasmarc avatar Mar 08 '22 20:03 jasmarc

As stated, this code has to be refactored so that authentication works with auth0, new links and guidelines can be found in the docs: https://api.tradestation.com/docs/fundamentals/authentication/auth-code/ A couple of additional comments once you got auth0 working:

  • once you've authenticated, make sure that you change your calls endpoints + args respecting new api version (v3). can be seen on the above docs + specs
  • add offline_access in scope so that you can have access to refresh_token and make the process algorithmic without having to login on each iteration. PLEASE NOTE THAT YOUR CONFIG FILE SHOULD BE ENCRYPTED/DECRYPTED on the fly, which isn't done here and is a security concern.
  • if you've done the above, simply login within the init function and the code will take care of understanding if it has to go through the lengthy authentication process or it has a refresh token to grab.
  • modify line 567: if response_headers['Content-Type'] == 'application/json; charset=utf-8' to ['application/json', 'charset=utf-8']

sfyll avatar Dec 14 '22 16:12 sfyll