tradestation-python-api
tradestation-python-api copied to clipboard
Tradestation has changed authentication from auth2 to auth0 Guardian
Tradestation has changed authentication from auth2 to auth0 Guardian. This library still uses auth2, Can you please update the authentication
Have you worked around this issue yet?
@Gabedave how is your fork coming along? Does it work?
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']