401 error when authenticating using python


I am trying to authenticate to a trading API I created using the code snippet found here: [Python] How to Authenticate Messages with Advanced Trade. However, after trial and error I continue to receive a 401: Unauthorized access error. Any troubleshooting suggestions are greatly appreciated.

More context:
. The trading API key is set up to View and Trade
. The Allow IP Addresses is blank
. I use the entire publicKey and privateKey text from the API key json, including the ‘-----BEGIN EC PUBLIC KEY’ and ‘-----BEGIN EC PRIVATE KEY’
. The only modification to the linked code snippet I made was copying over the “***” with the public and secret keys.

Thanks for any suggestions.

Carefully read the documentation! Your linked post has never used public/private keys…

Thank you for the reply! Perhaps I’m more inexperienced then I thought… is there a difference between “public/secret key” (in linked post) and “public/private key” (from trading key API json)?

Yes. Linked post use Legacy API key. You created Cloud API key. All needed information is in documentation - Advanced Trade API Authentication Overview | Coinbase Cloud.

Ah, that was it. Thank you very much :slight_smile: