Unable to retrieve auth token through credentials
abel30567 opened this issue · comments
// Below is an issue template, feel free to modify it
Code being executed:
var credentials = {
username: myUserName
password: myPassword
}
var Robinhood = require('robinhood')(credentials, function(){
console.log(Robinhood.auth_token());
// <authenticated alphanumeric token>
}
Expected result
// A little explanation, sample response JSON...
expected to retrieve auth token
Actual behaviour
// Either the error you received, or the JSON that was returned
Error: token not found {"statusCode":400,"body":{"detail":"Request blocked, challenge type required.","accept_challenge_types":{"sms":"SMS","email":"Email"}},"headers":{"date":"Thu, 10 Dec 2020 13:47:18 GMT","content-type":"application/json","content-length":"109","connection":"close","server":"openresty","allow":"POST, OPTIONS","x-robinhood-api-version":"0.0.0","content-security-policy":"default-src 'none'","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","x-xss-protection":"1; mode=block","access-control-allow-origin":"https://robinhood.com","vary":"Origin","trace-uuid":"d654c886-d262-4b74-bbf0-e0f6f2072bae"},"request":{"uri":{"protocol":"https:","slashes":true,"auth":null,"host":"api.robinhood.com","port":443,"hostname":"api.robinhood.com","hash":null,"search":null,"query":null,"pathname":"/oauth2/token/","path":"/oauth2/token/","href":"https://api.robinhood.com/oauth2/token/"},"method":"POST","headers":{"Host":"api.robinhood.com","Accept":"*/*","Accept-Encoding":"gzip, deflate","Referer":"https://robinhood.com/","Origin":"https://robinhood.com","content-type":"application/x-www-form-urlencoded","content-length":210}}}
at Request._callback (/Users/claudioatilano/Desktop/2020Code/myNetWorth/node_modules/robinhood/src/robinhood.js:154:17)
Reproducing
// Please provide a bit of context for the code snippet, were you authenticated?
No MFA enabled on account, I had to get JWT token through robinhood web inspector
@abel30567, in your case, the response from robinhood server was "statusCode":400
with a description of Request blocked, challenge type required.
It seems to indicate that the request isn't being formed correctly (potentially missing some header value of challenge_type
).
To better pinpoint what is going on, it may be helpful to try the following:
- Try enabling mfa? mfa is working for me with the latest release.
- Try reverting to the previous release before the mfa feature was re-enabled?
MFA worked for me