Robinhood API: Access denied: Invalid private key
complete
A
Arctic lime Goose
I am still having this issue and I generated with Python and Node. Both resulted in the error.
P
Petur
marked this post as
complete
This has now bee fixed so that both versions of the key-pair can be added.
Note that you will need to add both public and private key when creating your wallet
P
Petur
marked this post as
under review
P
Petur
Hello everyone,
We have done some investigating and found that there may be an issue with Robinhood's instructions here:
** EDIT:
We have found the reason for the difference and we will be able to add support for both versions. This ticket will be closed once this change gets released on our side. It still seems very strange that RH would provide 2 examples that result in different outputs, but this was the cause of the errors **
RH provides 2 examples on how to generate the key pair. However, these two methods do not result in the same key formats, so we suspect that RH has made a mistake when creating these samples.
In short, the Node.js sample works fine, but the Python sample does not work.
We are investigating if there is some way for us to use the Python-generated key pairs, but it seems unlikely.
In order to connect the Robinhood API, we recommend generating the key pair using the Node.js sample provided
T
Turquoise Stoat
Petur There is nothing wrong with the Python sample they provide IMO; it works as advertised, and returns base64 strings of the underlying encoded key byte arrays. I personally verified generating key pairs with at least 3 separate API keys, and successfully fetched Robinhood account and transaction data using those keys.
I did find, when trying to get it to work in Koinly, one of the forms initially rejected the key saying it was in the wrong format, but on the second try it accepted it (though the API still gave the error being discussed in this thread when syncing). I presumed it was due to a bug with the field validation logic, or from expecting the old key format used prior to August 2024 without the
rh-api
prefix (see https://docs.robinhood.com/crypto/trading/#section/Authentication/API%20Key)T
Turquoise Stoat
Petur does Koinly expect a url-safe b64 encoded string? It just occurred to me that might be the issue, and is easily fixed by using the second optional parameter when calling
base64.b64encode
.P
Petur
Turquoise Stoat:
Thanks for confirming.
We found the reason for the difference and we will be adding a fix.
Our developer used the Node.js sample when building the integration on our side, so we did not consider that the Python example could possibly be generating different outputs. This is why the Python keys aren't working on our side.
R
Respective Sparrow
sam issue for me, tried multiple keys and all give the same error when trying to sync
R
Ruling Angelfish
Same error please fix
F
Fancy Mockingbird
Any updates on this?
A
Absolute Caribou
I am having the same issues and have not been able to resolve. Is there any update here?