I just spun up a new sandbox (couple of hours old) and I am trying to setup a CI/CD process using BitBucket Pipelines and sfdx. When I run the force:auth:jwt:grant command with hardcoded values (i.e. client id, jwtkeyfile) and I am getting intermittent successes and failures. The error message I am getting is " ERROR running force:auth:jwt:grant: We encountered a JSON web token error, which is likely not an issue with Salesforce CLI. Here’s the error: user hasn't approved this consumer". Again the sandbox is relatively new and this error message happens 50-60% of the time. Any ideas?

  • 2
  • 2
    I've run into that error when the connected app used in the JWT flow hasn't been installed in the target org, but I'd think that'd give you a 100% fail rate. Is your connected app in your target org(s)? Is your connected app set to "users may self-authorize" or "selected profiles are pre-authorized"? Is your CI/CD pipeline using multiple users, or just a single user (when trying to auth, that is)?
    – Derek F
    Feb 12, 2020 at 0:06
  • The endpoint URL is usually the issue. Same root cause, different symptoms: salesforce.stackexchange.com/questions/278367/…
    – identigral
    Feb 12, 2020 at 0:08
  • @derekf it is one user only and the Connected app is in the target org. Identigral it's interesting that issue sounds like mine, but no communities in my org. Feb 12, 2020 at 0:26
  • I am wondering if it has to do with the "newness" of the sandbox Feb 12, 2020 at 0:28

1 Answer 1


So after 12 hours of sleeping, it seems as though the issue was DNS / Sandbox propagation. After waiting 12 hours, the authentication requests succeed every time now. Once again this is a very common issue with new Sandboxes and Authentication I have seen many times.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .