function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Tynan BurkeTynan Burke 

Connected app JWT/Oauth: "User Hasn't Approved This Consumer"

We're using JWT authentication for calls to the Salesforce API. I set it up this summer and it was working well. The app could refresh the token whenever it needed to and storing the result in memcache.

This recently stopped working, I guess. My local memcache got flushed and I noticed that I started getting an error:
{u'error_description': u"user hasn't approved this consumer", u'error': u'invalid_grant'}
(Other machines that still hold the old token work fine.)

As far as I can tell, nothing about the API user or its relationship to the connected app has changed. The app's policy is "Admin approved users are pre-authorized", and a profile containing the user is listed in 'Profiles' on the app configuration page.

Has anybody run into this before?
Harleen Mann 8Harleen Mann 8
"user hasn't approved this consumer" This is a common error caused when the user doesn't have a prior refresh_token associated with him/her.

The solution is to perform an Autorization grant (Web Server flow or User-Agent Flow) at least once.

I wrote in detail about it; look **specifically at step #3** here - https://mannharleen.github.io/2020-03-03-salesforce-jwt/

That should solve the error.