-
Notifications
You must be signed in to change notification settings - Fork 490
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
if challenge_respons['status']; key error 'status' #537
Comments
@clarin-ebtio800090 is this meant to be a working solution? _validate_sherrif_id is not defined and the time module is not imported in your solution. Thank you for digging into the issue however. |
i tried it and it didn't work |
Looks like only sms codes are used for authentication even though mfa is setup as authentication method. Not sure if its a new feature or bugged-release on RH |
any idea how to handle this? |
It seems to be that Robinhood insists on using the Trusted Device authentication method even after selecting and setting up the Authenticator App method and using the QR affiliated code. |
Does anyone know if it's the SMS code in addition to the authentication app? Or is it now just SMS? |
from what i can tell, it's both. when Authenticator App is selected in RobinHood it will set up with a QR & Code, but at login RobinHood will attempt to use Trusted Device instead. and with SMS Authentication set Stocks no longer prompts for input of the SMS code. |
Same issue here. Would anyone be able to help me out? |
I have been trying to check with robinhood support as they seem to have abandoned multi factor authentication option and using only sms, photo, gov-id, bank as valid form of authentication methods |
I am experiencing issues too. Bot will not log in and at the same time App will ask me to verify new device, which I do, but it dose not seem to go thru. |
Do we any way of using the pickle file from browser to be used instead of pickle file we are generating from app. If there is a way, can you please share the steps. |
workaround: Looks like this only works for 30 mins (sorry) def replace_pickle(code):
# Step 1: Create a Backup
shutil.copy(original_file_path, backup_file_path)
print(f"Backup created at: {backup_file_path}")
# Step 2: Load the Original Pickle File
with open(original_file_path, 'rb') as f:
data = pickle.load(f)
# Step 3: Replace the Bearer Token
new_bearer_token = code
if isinstance(data, dict) and "access_token" in data:
data["access_token"] = new_bearer_token
print("Bearer token replaced.")
else:
print("Bearer token not found in the pickle file.")
# Step 4: Save the Updated Pickle File
with open(original_file_path, 'wb') as f:
pickle.dump(data, f)
print(f"Updated pickle file saved at: {original_file_path}") |
I am not the best at usely solely network requests to login, so I'm going to automate the login via selenium, extract the token, and then just give it to the robinhood module. |
So what has changed from my perspective : I can log in via browser, when I do now I get a Robinhood app notification on my phone to verify it's me and a prompt to allow a new device, which I do and I am able to log in to the account via browser. Until now this did not exist and verification was done by entering / passing the 2FA code generated via totp = pyotp.TOTP(log_2FA).now() Now the Robinhood app notification on my phone happens the same when trying to log in via the script, however, after verifying new device in the app, I get an exception error and script just terminates it self ( have no procedure in place to handle that exception at this time ) . I still generate the 2FA code, the .token folder gets created but no pickle file is written, and the phone app validation fails and program just craps out on the exception created when trying to log in: login = r.login(log_User, log_Pass, mfa_code=totp) Seems Authentication.py will need to be modified again, whish I was smart enough to figure that one. Sorry Folks and thanks. |
Yep, indeed. Authentication.py needs to be modified to handle the new app notification method. I made the following modifications to the auth module and got it to work! bhyman67/Mods-to-robin-stocks-Authentication@02e5491 You should have 2 minutes to approve the login request in the Robinhood app from the moment that you call the login routine. |
This works perfectly! You truly saved my day, Mr. Hyman. Many thanks and much respect! |
brilliant stuff @bhyman67, where's the tip button on this thing? now the age old question: does anyone know how long these pickles last? ...and how can we make them last longer. |
I appreciate you! Wasn't looking forward to trying to figure out how to fix this. Now I just need to find a service that can grab the sms code for me. |
@bhyman67 If you have time to create a PR to fix this issue I would greatly appreciate it! I just merged another PR, so you should update your branch. |
Sounds good, @jmfernandes! I'll try to get to that sometime soon. |
Thanks so much, I got the Bot to log in. |
Is the new phone verification step intentional? That seems to defeat the point of having 2FA if they're going to just ask for a code with SMS anyways... |
What is the login flow now with these changes if we were to use external 2FA app?
|
is it possible to login by script without needing to manually approve the login request in the Robinhood app? |
I was able to successfully generate a fresh pickle file using this method - thank you for putting this solution together. However, I deleted the pickle file and reran to refresh the pickle, and app on phone is no longer generating the verification. Two minute window expires and no pickle file is generated. Anyone else experiencing this? I tried reverting to original authentication.py to see if it would work after having approved via app verification, but no success. I'm wondering if the revised authentication.py needs additional edits for handling cases where Robinhood account has already logged approval via the new verification process? |
Yeah I ran into the same problem... It worked initially, but then that same problem happened to me. Which is why I paused on going any further on the pull request. I think you're right that this needs further edits and testing... This doesn't seem to be a full working solution yet... |
For anyone who wants full automation, you can use something like selenium to manually plug in your username, password and possibly Auth app code and then plug in the sms code by linking robinhood to a Google voice number, having it forward the message to your Google email and then by using the Gmail app to read the code programmatically and plug it into the page. Convoluted, but that's the free option. Otherwise, you could use a Twilio number. |
Try a different IP? |
@ Kr1msonReaper; > For anyone who wants full automation, you can use something like selenium to manually plug in your username, password and possibly Auth app code and then plug in the sms code by linking robinhood to a Google voice number, having it forward the message to your Google email and then by using the Gmail app to read the code programmatically and plug it into the page.
Are you able to have your script log in without having to manually verify new device manually in the app ? |
I believe the SMS option is only available if you don't have the app. I haven't implemented the automation for myself because a single approval seems to be good for a while. Might get to it when I have the time and motivation. |
Sure thing!! Sure wish I could try bringing this thing to the finish line... Still been periodically checking how my 2fa process goes and if it ever goes back to using the device approval method (like it's supposed to do according to my settings) rather than the SMS method... |
Sorry if I missed this. But I keep getting the timeout error. Do we have to turnoff the Authenticator App authentication and use sms in robinhood? It seems we can only choose one Robinhood authentication option, but authentication.py needs by_sms also. Maybe by_sms and mfa_code variables need to be merged to a “auth_type” variable. Because why does challenge_type need to exist in the payload if the app user uses mfa? I think with the rh app update, when they added the sms option, it made it a requirement instead of being an option that was intended. could be wrong but shouldn’t the code check to see if mfa_code is being used before passing challenge_type with the payload? |
This fix works but you must delete the old pickle file first. otherwise its getting an expired challenge response. |
Hi Mike. I'm not quite sure... Robinhood's 2fa process is still a little funky. Feel free to share some code samples demonstrating your ideas and I'd be happy to take a look! |
I was able to automate the SMS verification. I don't know how to use github, so apologies for how scuffed this post will be, but I was able to solve it in under an hour with the help of ChatGPT. My solution also feels pretty situational with how my automated trading works, but maybe by writing how I did it here, I can help others find a personal fix for theirs as well. First, my trading algorithm runs off of my Macbook, so by syncing iMessage to also receive texts, I was now getting the verification codes for Robinhood on my Macbook's iMessage as well as my phone. Then, I used ChatGPT to make me a python script that would scrape the string of the entire most recent text message from the number Robinhood uses to send verification codes, and return the last 7 characters minus the period, so it would just be the six digit verification code. The code looks like this:
Finally, I saved that script (titled getLastText) to the same folder that authentication.py exists in. I edited the authentication.py file to import the function that scrapes the verification code, and changed the authentication.py code from this:
To this:
I added in the time.sleep(10) because I delete the pickle file daily with automation and generate a new one each day before market open, so my authentication.py isn't required to be super fast. Furthermore, for SMS it's unknown to me how fast the text gets received, therefore the slight delay exists. I should also note that to whoever thought that using twilio would be a solution, I tried entering a twilio phone number into Robinhood to replace my actual phone number, and it wouldn't let me, saying that it was a security risk. So as far as I know, this is the best way I've discovered so far to automate the login process. Change your authentication method to SMS instead of the authenticator app, and find a solution similar to what I did. If you are editing my code and doing what I did, you will need to edit the phone_number variable in my scripts to whatever number the Robinhood texts come from. I set it to 00000 in these scripts because I was unsure if it would be a security risk for me or not (for any reason). |
Having a hard time finding the pickle file. |
C\users\{username}\.token
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Tigeredgar ***@***.***>
Sent: Tuesday, January 28, 2025 4:43:44 PM
To: jmfernandes/robin_stocks ***@***.***>
Cc: Anton Esterhuizen ***@***.***>; Comment ***@***.***>
Subject: Re: [jmfernandes/robin_stocks] if challenge_respons['status']; key error 'status' (Issue #537)
Having a hard time finding the pickle file.
Where is the pickle file located?
—
Reply to this email directly, view it on GitHub<#537 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ACQJEAKRW4NLWLV3TBD5N4T2M72ZBAVCNFSM6AAAAABVNEZ24CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMRQGEYTMNJRHE>.
You are receiving this because you commented.Message ID: ***@***.***>
|
are there any fixes yet for my robinhood app sending verification code instead of device approval? i tried that fork but i still get packages\robin_stocks\robinhood\authentication.py", line 188, in login |
|
this works. i havent tried with the authenticator app set as verification, but it works for the SMS verification method. Care to explain what you changed? THANK YOU, this is great. wish i could help |
####REPLY#### |
@mike-labadessa
|
I used the new authorization.py file. It has been working for two weeks until now I am getting this new error I also couldn't log in my account from the RBH webpage. It kept loading in the login page. |
@schnup check vpn |
@nickreynolds84 I got Gates8911 1st solution to work by switching from mfa to text verification. |
This new auth method has been working for a few days and stopped working now ... |
I just tried a second a go and it worked. Maybe try restarting your kernel. I tried a second time and it crashed on the sheriff_id. But restarting the kernel fixed it |
@nickreynolds84 |
Thanks @mike-labadessa. I'll try this first |
@Gates8911 I copied your last solution to try next, just haven't gotten to it yet. I'm hoping to continue to authenticate using mfa because I am not always available to answer the text verification like others have seemed to get to work |
@mike-labadessa @nickreynolds84 @henryzhangpku @alex-l-zhou @schnup |
Triggering the rs.update_session() every 23 hours makes sense because 86400 seconds equal one day. Maybe Robinhood devs hardcoded 86400 on their end somewhere. Thanks @Gates8911 |
If anyone needs another authentication to try let me know, I made one more, wasnt fully convinced I had all possibilities covered. Didnt automatically post it bc i didnt want to spam this chat with more code. Just email me if you need another one to try. Mgates8900@gmail.com |
Thanks so much for your time and contribution to the cause ;), same goes to all in here. |
Just curious why no one here uses alpaca instead |
Overpriced--Much better to use programming skills to do it yourself.
…On Thu, Feb 6, 2025, 12:54 PM Ebenezer Adams ***@***.***> wrote:
Just curious why no one here uses alpaca instead
—
Reply to this email directly, view it on GitHub
<#537 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKFGJXLWNTLFP7KGHDZS5JD2OO4VTAVCNFSM6AAAAABVNEZ24CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNBQHA2TIMZWGA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
How specifically are they overpriced? Aren't their spreads similar to Robinhood's? Although actually building this unofficial Robinhood API has taken a lot of work, it doesn't seems to me like there is any difference in "programming skills" required to use it vs. using Alpaca's official one. |
@doctorcolossus @Kr1msonReaper @nickreynolds84 @mobeston @Adelantado @mike-labadessa @henryzhangpku @alex-l-zhou @ravi-bharadwaj @pielshawn @zabidin901 @HMSS013 @jmfernandes @cpasean @nat2k5us @schnup
|
Login is not operating as before. The RH app prompts me to confirm that I'm attempting to log in but the program does not authenticate.
The text was updated successfully, but these errors were encountered: