Skip to content
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

unable to get login using correct credentials #35

Closed
matthewkooshad opened this issue Nov 19, 2018 · 3 comments
Closed

unable to get login using correct credentials #35

matthewkooshad opened this issue Nov 19, 2018 · 3 comments

Comments

@matthewkooshad
Copy link

i removed special characters from my password as i found noted in #5 -- even after doing that, i get the same error as before i changed my password:

Traceback (most recent call last):
File "d:\app\robinhood-to-csv\csv-export.py", line 46, in
logged_in = robinhood.login(username=username, password=password)
File "d:\app\robinhood-to-csv\Robinhood.py", line 81, in login
res = res.json()
File "d:\dev\Python37\lib\site-packages\requests\models.py", line 897, in json
return complexjson.loads(self.text, **kwargs)
File "d:\dev\Python37\lib\json_init_.py", line 348, in loads
return _default_decoder.decode(s)
File "d:\dev\Python37\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "d:\dev\Python37\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

@abhikush
Copy link

abhikush commented Dec 14, 2018

I was able to get it to work for my use after making changes in Robinhood.py.

  • Change the login endpoint to "login": "https://api.robinhood.com/oauth2/token/" (Search for "login": "https://api.robinhood.com/api-token-auth/")
  • Add client_id = "c82SH0WZOsabOXGP2sxqcj34FxkvfnWRZBKlBjFS" after positions = None
  • Search for "if mfa_code:" and change as follows:
    if mfa_code: fields = {'password': self.password, 'username': self.username, 'mfa_code': self.mfa_code', grant_type': 'password', 'client_id': self.client_id} else: fields = {'password': self.password, 'username': self.username, 'grant_type': 'password', 'client_id': self.client_id}
  • Change self.auth_token = res['token'] to self.auth_token = res['access_token']
  • Change self.headers['Authorization'] = 'Token '+self.auth_token to self.headers['Authorization'] = 'Bearer ' + self.auth_token

If you have any other issues just refer https://github.com/Jamonek/Robinhood/blob/master/Robinhood/Robinhood.py and make changes in your Robinhood.py

@abhikush
Copy link

Couldn't get code in the 3 bullet to format correctly but just follow the format in existing code.

@joshfraser
Copy link
Owner

Merged the fix for this. Thanks for your patience folks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants