I am attempting to authorize a developer Sandbox using JWT in an attempt to implement a CI process. I found this related question on the subject:

Can I connect to a sandbox using JWT Flow and Prod connect app?

I have attempted to follow the advice given there. I am able to use JWT in my production org without any issues. The sandbox I am attempting to auth into was created off of production, so the connected app that I use in production is also in the Sandbox, but with a different client secret. However when I try to authorize into the sandbox:

sfdx force:auth:jwt:grant --clientid <clientId-from-sandbox> 
--jwtkeyfile <path-to-server.key> 
--username <sytem-admin> --instanceurl <instance-url-for-sandbox>

I get the following error:

ERROR:  This org appears to have a problem with its OAuth configuration. 
Reason: invalid_grant - audience is invalid 

Anyone have any idea what I'm doing wrong here?

  • For the <instance-url-for-sandbox> variable, are you using the full qualified URL to the SB, or just test.salesforce.com? – Rodrigo Jan 11 at 16:11
  • @Rodrigo I'm using the full qualified url as all of our sandboxes utilize My Domain. Though I have tried using test.salesforce.com to no avail. – blastocyst.jones Jan 11 at 16:57

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.