robinhood-unofficial / pyrh

Python Framework to make trades with the unofficial Robinhood API
https://pyrh.readthedocs.io/en/latest/
MIT License
1.77k stars 603 forks source link

AuthenticationError: Email code is no longer supported. Please request SMS code sent to your phone number. #279

Closed diogobotelho closed 3 years ago

diogobotelho commented 3 years ago

Anyone having this recent message when logging in? Does this mean robinhood is not supporting email codes anymore?

HaxOh commented 3 years ago

Getting the same issue, haven't had much time to work on it. The SMS codes aren't working either though.

zyxelenator commented 3 years ago

Yeap, stopped working several days ago. No code arrives in email like before. If you switch to SMS, it does not work with that code...

diogobotelho commented 3 years ago

I can make it work with sms code.


From: zyxelenator notifications@github.com Sent: Wednesday, October 14, 2020 9:56:58 AM To: robinhood-unofficial/pyrh pyrh@noreply.github.com Cc: Diogo Botelho diogo.botelho@live.com; Author author@noreply.github.com Subject: Re: [robinhood-unofficial/pyrh] AuthenticationError: Email code is no longer supported. Please request SMS code sent to your phone number. (#279)

Yeap, stopped working several days ago. No code arrives in email like before. If you switch to SMS, it does not work with that code...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Frobinhood-unofficial%2Fpyrh%2Fissues%2F279%23issuecomment-708420760&data=04%7C01%7C%7C2ade8e388dae4eed600408d8704904f8%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637382806194425607%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=vslnin6o1kkrDcojvIQRfHztygc6wk2N4Kn5%2FrxOFm0%3D&reserved=0, or unsubscribehttps://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAESTZNXFROLQN3COTCANXX3SKWU2VANCNFSM4SNN7S3A&data=04%7C01%7C%7C2ade8e388dae4eed600408d8704904f8%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637382806194435607%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=eMalgFcAVgg1YVhtep4%2B2lzjoO%2BAs%2BV%2BHf8M8sLq8d8%3D&reserved=0.

zyxelenator commented 3 years ago

I can make it work with sms code.

After entering SMS code:

Traceback (most recent call last): File "/home/zyxelenator/.local/lib/python3.6/site-packages/pyrh/robinhood.py", line 215, in login res2.raise_for_status() File "/home/zyxelenator/.local/lib/python3.6/site-packages/requests/models.py", line 941, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api.robinhood.com/challenge//respond/

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "RobinhoodBot.py", line 11, in rh.login(username="blablab", password="blabla") File "/home/zyxelenator/.local/lib/python3.6/site-packages/pyrh/robinhood.py", line 228, in login raise RH_exception.LoginFailed() pyrh.exceptions.LoginFailed

HaxOh commented 3 years ago

I can make it work with sms code.

Care to share what you've done to get it working with the sms code?

diogobotelho commented 3 years ago

I just use this:

from pyrh import Robinhood rh=robinhood(username=rhlg, password=rhpa, challenge_type=rhlg_challengetype) rh.login()

rhlg_challengetype=”sms”

let me know if you get any error with this.

Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10

From: HaxOhmailto:notifications@github.com Sent: Wednesday, October 14, 2020 10:42 AM To: robinhood-unofficial/pyrhmailto:pyrh@noreply.github.com Cc: Diogo Botelhomailto:diogo.botelho@live.com; Authormailto:author@noreply.github.com Subject: Re: [robinhood-unofficial/pyrh] AuthenticationError: Email code is no longer supported. Please request SMS code sent to your phone number. (#279)

I can make it work with sms code.

Care to share what you've done to get it working with the sms code?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Frobinhood-unofficial%2Fpyrh%2Fissues%2F279%23issuecomment-708449474&data=04%7C01%7C%7C2032de5fdc5243f39bb008d8704f55f2%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637382833324282766%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ppYmXL6T5sIwTTP6I4%2BxUHueBhcn5hxjMCMF66CNHKA%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAESTZNWLRTHIY2VLFX52BA3SKW2EHANCNFSM4SNN7S3A&data=04%7C01%7C%7C2032de5fdc5243f39bb008d8704f55f2%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637382833324282766%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=bemwCktQScR6xNYDV0nkXFLOXpqWV9%2BbWnTwZWtshYM%3D&reserved=0.

HaxOh commented 3 years ago

Works great! Thanks!

tannerarriza commented 3 years ago

I am still getting the same error @zyxelenator was getting with the code you recommended @diogobotelho , I am currently running pyrh version 2.0 and when I introspect on the constructor function, it tells me that it has no parameters. I am also using Python 3.8.

import inspect inspect.signature(Robinhood.init)

returns --> <Signature (self)>

Are the rest of you who got it working using a different version? Any help is greatly appreciated.

diogobotelho commented 3 years ago

I am still getting the same error @zyxelenator was getting with the code you recommended @diogobotelho , I am currently running pyrh version 2.0 and when I introspect on the constructor function, it tells me that it has no parameters. I am also using Python 3.8.

import inspect inspect.signature(Robinhood.init)

returns --> <Signature (self)>

Are the rest of you who got it working using a different version? Any help is greatly appreciated.

"https://api.robinhood.com/challenge//respond/" is incorrect (two "/"). I had q similar problem before with the .cancel_order() function and I had to change the code to make it work so it requests from the correct url. Not sure what is the best way to fix this. Can someone help?

hyperstripe50 commented 3 years ago

I encountered this error when I had 2FA set to SMS for my Robinhood account. To fix the issue I did the following

  1. Disable 2FA by logging in online. See here
  2. Set challenge_type to sms
    from pyrh import Robinhood
    rh = Robinhood()
    rh.login(username=xxxx, password=xxxx, challenge_type="sms")
    rh.get_quote('AAPL')

    Even though 2FA was disabled, I still received an SMS message with a code.

    > No 2FA Given
    sms code:
    xxxxx
    {
    "ask_price": "116.820000",
    "ask_size": 25,
    "bid_price": "116.000000",
    "bid_size": 4,
    "last_trade_price": "116.590000",
    "last_extended_hours_trade_price": "116.460000",
    "previous_close": "116.030000",
    "adjusted_previous_close": "116.030000",
    "previous_close_date": "2020-11-25",
    "symbol": "AAPL",
    "trading_halted": false,
    "has_traded": true,
    "last_trade_price_source": "consolidated",
    "updated_at": "2020-11-27T22:00:00Z",
    "instrument": "https://api.robinhood.com/instruments/450dfc6d-5510-4d40-abfb-f633b7d9be3e/"
    }
zyxelenator commented 3 years ago

I encountered this error when I had 2FA set to SMS for my Robinhood account. To fix the issue I did the following

  1. Disable 2FA by logging in online. See here
  2. Set challenge_type to sms
from pyrh import Robinhood
rh = Robinhood()
rh.login(username=xxxx, password=xxxx, challenge_type="sms")
rh.get_quote('AAPL')

Even though 2FA was disabled, I still received an SMS message with a code.

> No 2FA Given
sms code:
xxxxx
{
  "ask_price": "116.820000",
  "ask_size": 25,
  "bid_price": "116.000000",
  "bid_size": 4,
  "last_trade_price": "116.590000",
  "last_extended_hours_trade_price": "116.460000",
  "previous_close": "116.030000",
  "adjusted_previous_close": "116.030000",
  "previous_close_date": "2020-11-25",
  "symbol": "AAPL",
  "trading_halted": false,
  "has_traded": true,
  "last_trade_price_source": "consolidated",
  "updated_at": "2020-11-27T22:00:00Z",
  "instrument": "https://api.robinhood.com/instruments/450dfc6d-5510-4d40-abfb-f633b7d9be3e/"
}

Thanks. I had the same, the only part I was missing is disabling 2FA in my robinhood account! Now it works with SMS code.

stale[bot] commented 3 years ago

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.

stale[bot] commented 3 years ago

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.