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.73k stars 467 forks source link

Able to login with incorrect credentials using login() #270

Open rizahassan opened 3 years ago

rizahassan commented 3 years ago

Hello, I am new to using robin_stocks for Robinhood API. Looking forward to suggestions on this issue.

I am trying to figure out how to determine if a user logs in with incorrect credential. Currently, if a user inputs any username and password in the login() arguments (including a false credential), the program will return an access token. The code is shown below:

login = rh.login(username,password,expireMin,mfa_code=totp)
            print((login), file=sys.stderr)

            # Get the access token from the robinhood login
            access = login.get('access_token',None)

How can we check using robin_stocks if a user is logging in with incorrect credential?

tarricsookdeo commented 3 years ago

Perhaps try to use that access token to get the account information. If the account info check returns something (like an email), then the credentials provided are valid. Not sure if this will work. But I think it's worth giving it a shot.