0

I have just refreshed a sandbox and updated the Consumer Key on a connected app but I keep getting Error authenticating with JWT config due to: user hasn't approved this consumer. Admin approved users are pre-authorized is selected with the System Admin profile. I've tried changing it to All users may self-authorize and back again but I can't get it to work.

This is working fine in production and in multiple sandboxes, including this one before I refreshed it. How can I get the user to approve the consumer?

1 Answer 1

0

Sandbox refreshes cause a completely new and independent version of your connected apps from production to be created and installed in the refreshed sandbox.

You need to go through an OAuth flow that returns a refresh token (web server flow, user-agent flow) before you can use the JWT Bearer flow whenever you're using a new connected app for the first time (and it is a new connected app with its own consumer key and secret).

The easiest way I've found to do this is to use a tool like Postman to go through the web server (Authorization Code) flow. If you're not familiar with how to do that, I go into a little more detail on a similar question from 2 weeks ago

3
  • Thanks I've tried your approach using postman but im getting the below error after I login to my sandbox Authentication failed Couldn't complete authentication. Check the Postman Console for more details. "Error: grant type not supported" Commented May 3, 2022 at 22:33
  • 1
    Also why would I need to go through this process if Admin approved users are pre-authorized is already selected? Commented May 3, 2022 at 23:38
  • @jonny-harte Can't really help with the postman error other than to say "double check you've filled everything out correctly". As for why you need to go through the process, that's just what Salesforce dictates. Again, this is a completely new connected app in your refreshed sandbox that hasn't been used before, ever. The way Salesforce implemented the JWT Bearer flow dictates that you must go through another flow (one that can give you a refresh token) once per org before you can use the JWT Bearer flow in that org.
    – Derek F
    Commented May 5, 2022 at 0:42

You must log in to answer this question.

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