rghuckins / robinhood-google-sheets

Robinhood Custom Functions for Google Sheets 📈
146 stars 47 forks source link

Incorrect Authentication credentials. Error while running script. #9

Open rs1990 opened 4 years ago

rs1990 commented 4 years ago

HI

I followed the instructions and when i try to login , i get this error.

I have changed the username and password to the correct details. i confirmed using the same login credentials and they are correct.

Could you help please

Error Robinhood API request failed. 401: {"detail":"Incorrect authentication credentials."} (line 89).
fkotsian commented 4 years ago

Should be closed by https://github.com/rghuckins/robinhood-google-sheets/pull/10, pls try copy/pastaing latest robinhood.gs on that branch into your sheets [EDIT] and fill in the device_token

(you need a device_token for RH's new Oauth flow 😄 )

joecho27 commented 4 years ago

I copied the latest robinhood.gs (the one w/ client_id in it) and I still get the same error as OP.

ParitoshKelkar commented 4 years ago

Same issue here as well.

fkotsian commented 4 years ago

Hey guys, you need a device_token as well. Check out https://github.com/rghuckins/robinhood-google-sheets/pull/10/files

[EDIT: thanks @philgapp!]

ParitoshKelkar commented 4 years ago

Still facing the same error ..

philgapp commented 4 years ago

I can confirm I am getting the identical error. I am building out a personal trade management tracker and planner in Sheets and Scripts. The client_id for my personal RH session in a browser matches what is in the latest version of this script: window.oauthClientId = "c82SH0WZOsabOXGP2sxqcj34FxkvfnWRZBKlBjFS"; (BROWSER) and 'client_id': "c82SH0WZOsabOXGP2sxqcj34FxkvfnWRZBKlBjFS", (SCRIPT) I did have MFA enabled but it is now disabled. I am going to attempt a logout in the browser, cache refresh and logging back in....

philgapp commented 4 years ago

I can confirm I am getting the identical error. I am building out a personal trade management tracker and planner in Sheets and Scripts. The client_id for my personal RH session in a browser matches what is in the latest version of this script: window.oauthClientId = "c82SH0WZOsabOXGP2sxqcj34FxkvfnWRZBKlBjFS"; (BROWSER) and 'client_id': "c82SH0WZOsabOXGP2sxqcj34FxkvfnWRZBKlBjFS", (SCRIPT) I did have MFA enabled but it is now disabled. I am going to attempt a logout in the browser, cache refresh and logging back in....

This is resolved for me by adding device_token to the function below: function getAccessToken_() { var url = robinhoodApiBaseUrl + '/oauth2/token/'; var payload = { 'grant_type': "password", 'scope': "internal", 'client_id': "c82SH0WZOsabOXGP2sxqcj34FxkvfnWRZBKlBjFS", 'device_token' : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx", //'auth_token' : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", 'username': robinhoodUsername, 'password': robinhoodPassword };

You can find this value by logging in with Chrome, Inspecting the page, go to Applications and expand the Cookies on the left, click the one for robinhood.com and then filter on the right for device_id. Copy that value and add it as device_token as above, and save and try again. Let me know, I want to actively use this in my project and share for help, as I'm not an expert developer by any means. I am however passionate about more intelligent trading software that helps educate and guide new investors.

ParitoshKelkar commented 4 years ago

That worked for me too, thanks @philgapp

KSanchez999 commented 4 years ago

I'm having this issue as well. I'm using the robinhood.gs script updated 10 days ago. I have a device token but I'm still getting an authentication credentials error.

jomclky commented 3 years ago

@rghuckins I have all the correct info but I still receive this same error. Any help?

adeedchoudhury commented 3 years ago

Yep facing same issue as 2 commentors above me - I have the device_token (from the stackoverflow link) but still getting a 401 error code... (Invalid authentication credentials)

cstampar commented 3 years ago

Also got my device token and put in script editor, i get a text with a verification code and the same response as others in sheets cell: "incorrect authentication credentials"

dheerajn commented 3 years ago

Thank you for this awesome code but I have the same issue. I took the device_id value from the website and pasted it in the code and saved but I still have issue. Can someone help me please? I have getting the following error

Robinhood API request failed. 401: {"detail":"Incorrect authentication credentials."} (line 84).