Closed JJSax closed 4 years ago
@JJSax this error is based on the url the api is trying to call. notice on line 6, above, the url has 2 slashes: https://api.robinhood.com/challenge//respond/
... it seems like it's not passing in a challenge_id
on login: https://github.com/robinhood-unofficial/pyrh/blob/master/pyrh/urls.py#L64
Have you tried setting up 2FA from the robinhood app instead?
Have you tried setting up 2FA from the robinhood app instead?
I actually set my whole account up with the app, including the 2FA. Do you think I should redo the 2FA on my app again?
Hello I figured this out; this issue tilted me as well.
You need to:
Hello I figured this out; this issue tilted me as well.
You need to:
- Turn off SMS, etc. 2FA (when you turn this off, you will get email codes to verify log-ins).
- Start running the program code.
- Check your email, and copy and paste the email code into the terminal prompt and hit Enter.
Thanks for the reply! I tried your steps, and I'm not getting the email code at all.
Thanks for the reply! I tried your steps, and I'm not getting the email code at all.
That is very strange. See this: https://robinhood.com/us/en/support/articles/verifying-its-you/
What if I’m not getting my verification emails?
Make sure the verification emails aren’t being routed to your spam folder. Make sure your email address is entered correctly. Here’s how you can update your email address.
By turning off 2FA, when you try to log on from a new device, or in this case, from your program when it tries to log you on, Robinhood should send you an email code.
@JJSax I think I just disabled it and re-enabled it for it to work. It may automatically set the authentication method to SMS once enabled. Do you get the "Input mfa code:" input message when you run your code? (https://github.com/robinhood-unofficial/pyrh/blob/master/pyrh/models/sessionmanager.py#L395)
@JJSax I think I just disabled it and re-enabled it for it to work. It may automatically set the authentication method to SMS once enabled. Do you get the "Input mfa code:" input message when you run your code?
I do get that message each time. I tried toggling SMS off and back on, and I still get the error while using SMS. When I get it through email, it goes through as I would expect and prints out share price for AAPL.
I figured out why my email was having issues. I forgot I made a new folder for my investments in Gmail and that's where they were going. I checked spam and inbox thinking I was being smart. lol.
I do notice that it requires the 2FA code every time I run the code though. Is that normal? Is there any way to only have to do it once?
I do get that message each time. I tried toggling SMS off and back on, and I still get the error while using SMS. When I get it through email, it goes through as I would expect and prints out share price for AAPL.
I figured out why my email was having issues. I forgot I made a new folder for my investments in Gmail and that's where they were going. I checked spam and inbox thinking I was being smart. lol.
I do notice that it requires the 2FA code every time I run the code though. Is that normal? Is there any way to only have to do it once?
I think you need to keep SMS authentication and the likes off to continue getting email code notifications. Keeping it off means you will only get email codes and not SMS codes.
Logically, I think we do need to paste the email code every time we run it since the program is requesting access every time. This is honestly very annoying since I am dealing with my bot trading 1 stock company at a time, and if I want to automate trading with more than 1 company, I will need to paste the code n times for n companies.
Logically, I think we do need to paste the email code every time we run it since the program is requesting access every time. This is honestly very annoying since I am dealing with my bot trading 1 stock company at a time, and if I want to automate trading with more than 1 company, I will need to paste the code n times for n companies.
I found a way to prevent having to put the code in several times. Robinhood was thinking the device was a new device each time because pyrh is generating a new device_token each time, and not saving your generated device token. I guarantee there is a better way to do it, and I cannot guarantee this method is a secure way of doing this. This worked for me and I don't have to do the 2FA each time. If anyone knows a better/more secure way let me know.
Add this print line to get your device_token
if self.device_token == "": #this is around line 146
self.GenerateDeviceToken()
print(self.device_token) #you only need this once
After that go to line 65 or so and make your device_token what it prints out.
self.session.headers = self.headers
self.device_token = "" #put the string that prints out here. I redacted mine for my security.
self.challenge_id = ""
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Closing this issue automatically because it has not had any activity since it has been marked as stale. If you think it is still relevant and should be addressed, feel free to open a new one.
Hi, I'm having difficulties getting started. My code is almost identical to your quickstart code, the only difference being I have my username and password in another file. After I put in the 2FA code that was sent to my phone, it gives me this error. If I intentionally put in the wrong password, it doesn't send me the code, so my login credentials are right.
I apologize if this isn't the best place to submit this. I just don't know what I'm doing wrong. Thank you for your time.
edit: I forgot to put in my code.