Happy Business Starts Here

OAuth with API Sandbox

New Student

OAuth with API Sandbox

In my sandbox account, I created a dedicated API user and an OAuth client for this user. Please let me know how I can generate an OAuth token with the client id and client secret. The end point https://rest.zuora.com/oauth/token as given here (https://www.zuora.com/developer/api-reference/#tag/OAuth) does not seem to work with a sand box account. The document https://knowledgecenter.zuora.com/BB_Introducing_Z_Business/D_Zuora_Environments suggests that OAuth 2.0 is the recommended authentication scheme for the API Sandbox. Can you please help? Note that I can access the endpoints using the username and password. 


The following command fails with 

{"error":"unauthorized","error_description":"Bad credentials"} - 


curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "client_id=XXX" --data-urlencode "client_secret=XXX" -d "grant_type=client_credentials" "https://rest.zuora.com/oauth/token"



Tags (3)
Zuora Product Team

Re: OAuth with API Sandbox

Hi @suchitraramani, please use the API Sandbox URL instead of Production:


curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "client_id=XXX" --data-urlencode "client_secret=XXX" -d "grant_type=client_credentials" "https://rest.apisandbox.zuora.com/oauth/token"