jmfernandes / robin_stocks

This is a library to use with Robinhood Financial App. It currently supports trading crypto-currencies, options, and stocks. In addition, it can be used to get real time ticker information, assess the performance of your portfolio, and can also get tax documents, total dividends paid, and more. More info at
http://www.robin-stocks.com
MIT License
1.72k stars 464 forks source link

Robinhood pickle file not saving authentication #301

Closed nickdela closed 3 years ago

nickdela commented 3 years ago

Robinhood.authentication.login() always throws the error ERROR: There was an issue loading pickle file. Authentication may be expired - logging in normally.

nickdela commented 3 years ago

pickle authentication storage not working

Push #300 suggests the device token is always changing

I installed push #300 “fix the ever changing…” which seems related but the error remains

Users also noted correctly every login creates a new Robinhood device

Users also noted correctly Pickle file has strange characters in it

tested on macOS and Linux

nickdela commented 3 years ago

Closed issue #296 seems to be the exact same issue. Not sure why it was closed

bgridley commented 3 years ago

I resolved this error by changing robinhood/authentication.py at this line

res = helper.request_get(
                        urls.portfolio_profile(), 'regular', payload, jsonify_data=False)

to this

res = helper.request_get(
                        urls.portfolio_profile(), 'regular', jsonify_data=False)

The request shouldn't be sending a payload in a get request anyway, in doing so it adds the username and password to the URL as parameters. This is insecure. This change is much more secure as it will no longer send the username and password in the get request url as parameters, and simply checks if the session is still valid, without sending the information and fixes the "ERROR: There was an issue loading the pickle file"

nickdela commented 3 years ago

Works, thanks. You should submit a push. @jmfernandes

bfoz commented 3 years ago

@bgridley Are you going to submit a PR for this? If not, can I add it to #300?