sfdx force:jwt:grant unable to authenticate

How to fix sfdx force:jwt:grant unable to authenticate issue.

When you try to login to your sandbox using SFDX at times you might comes across this error which is ...

sfdx force:jwt:grant unable to authenticate

The fix is simple though, you need to run this command in your terminal (if you are using a mac)

export SFDX_AUDIENCE_URL=https://test.salesforce.com
Run this command in Terminal

Which basically means that you are looking forward to get authenticated against a sandbox and not Developer Org or Production Org.

If you are using Visual Studio Code you can also make some changes to the sfdx-project.json file to get around this problem.  

  1. Open the project and go to sfdx-project.json file
  2. Change sfdcLoginUrl from https://login.salesforce.com to https://test.salesforce.com
  3. Authorize your org

Hope this help!