-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LoginException: 400 Client Error: Bad Request for https://api.robinhood.com/oauth2/token/ #7
Comments
I did double-check my credentials. |
I found a similar issue on Jamonek's repo. aamazie claims that he has resolved this in his fork. I believe this is the relevant commit. I don't understand the code at first glance. Maybe this information will help you. If not, I will try to work on it when I can find some more free time. |
i will work on it during the weekend. Thanks for reporting this |
hi, the current master now supports the mfa use case : bc6daec |
Hi wang-ye, I had been busy with school and just got a chance to test this. It is possible that something else changed since you fixed this, or maybe I am overlooking something about how to use MFA authentication. However, I'm still getting the same error as before with your latest code:
|
I just checked and verified that self.GenerateDeviceToken() is indeed running and returning a device_token to self.device_token. It looks legit - it's a dash-separated hex value with digits {8}-{4}-{4}-{4}-{12}. |
Okay, I just noticed I got a bunch of SMS verification codes from Robinhood - so I think that's the issue. You need to handle the challenge somehow. See lines 166-180 in aamazie's fork of Jamonek's repo. |
Did you type in the verification codes in the terminal? bc6daec#diff-7f3fc7d4172fcd78eb5c5dc07ac78047R181 |
I am never prompted for a verification code. Using the latest code, I get an error due to self.device_token not being initialized.
If I add
|
On my local run I got the MFA prompt. |
Hmm, interesting. I installed Postman, but I've never used it before. I used to use the Live HTTP Headers Firefox plugin, so I assume it's something similar to that. I'm pretty busy with schoolwork right now, but I'll try to dig deeper as soon as I can find and I'll let you know if I can find any clues about what could be causing this problem. |
Sorry for the delay! I have been busy and was also procrastinating learning Postman. I decided to just be lazy and use the logging package. Here is the full output with httplib and requests debugging. I did receive the SMS code right after making this request.
|
Below is a comparison between the failed authentication request made by robinhood-crypto with the successful one made by aamazie's Robinhood fork. Both requests resulted in receiving an SMS authentication code. The key differences I have been able to spot are the following:
robinhood-crypto:
aamazie/Robinhood:
|
A-ha! I think I've figured it out. I just noticed that aamazie/Robinhood's request is also met with an
You're doing:
In other words, we should expect a "bad request" response the first time, when the challenge is issued. Then we need to set the |
Hey doctorcolossus/wang-ye, did you ever find a solution to the SMS issue? I am having the same issue with the LoginException, where I am not prompted to input my MFA prompt. I still get the SMS message from robinhood, but I get the login error at line 187 before I can input the code. Thanks |
I described what needs to be changed in my last comment - handle or ignore the first one (or two? iiirc) HTTP "400 Bad Request" responses. I am not sure when I'll have time to work on a fix, as I'm traveling now and busy with another project, then starting a new semester at school in a couple of weeks. I'm hoping wang-ye will find time, but if he doesn't and I find some time during next semester, I will have a go at it and report back here. |
I had the same problem with the login exception. I was getting the SMS from Robinhood and everything you guys are describing. But still, I wasn't prompt to input my MFA. What I figure was that the Robinhood Two-Factor Authentication was off in my setting, even though I was getting SMS. When I turned that setting on in Robinhood the login started working and asking for the MFA. It is counter-intuitive because I was getting the SMS from Robinhood. I hope that helps some of you guys. |
As of 2019/5/3 15:25 (UTC +2), I have been getting the following robinhood_crypto_api.robinhood_crypto_api.LoginException:
Had been busy, unfortunately didn't check my script and notice till today.
Any ideas?
The text was updated successfully, but these errors were encountered: