+ Start a Discussion
Tory NethertonTory Netherton 

Continuous Integration Using Salesforce DX: Create Your Connected App: Error: invalid_grant - user hasn't approved this consumer

I am attempting to complete the aforementioned trailhead step on a Windows 10 machine. When I attempt to test the setup via sfdx force:auth:jwt:grant, I get the following error:

This org appears to have a problem with its OAuth configuration. Reason: invalid_grant - user hasn't approved this consumer

When it gives the error, SFDX provides a list of possible issues to check for. I have done so repeatedly. I have gone through the Trailhead step backwards and forwards. Every other part seems to work just fine. This part does not. Unfortuntely the Google results haven't really been all that helpful, so now I turn to you oh great and powerful forum. What do you say?
SandhyaSandhya (Salesforce Developers) 
Hi,

Make sure that you are logged in as System Adminstartor and also you followed below steps for connected app.

Click Manage.
Click Edit Policies.
In the OAuth policies section, for Permitted Users select Admin approved users are pre-authorized, then click OK.
Click Save.

Also refer below link.

https://salesforce.stackexchange.com/questions/164412/setting-up-jwt-oauth-flow
 
Please mark it as solved if my reply was helpful. It will make it available for other as the proper solution.
 
Best Regards
Sandhya
 
Arjun AnilkumarArjun Anilkumar
hi Torry,
Facing the same issue and not yet found a solution, have you found a way out of this? 
Ramn_rRamn_r
check if your profile is added to the connected app
Rohit RadhakrishnanRohit Radhakrishnan
Incase this is not yet resolved. Please have a look at this blog on authenticating using JWT.
https://salesforcerealm.com/2020/03/07/authenticate-sfdx-using-jwt/
ZHANG XINGZHANG XING
Hi @Rohit Radhakrishnan
Thank you. I followed these step of the video and fixed this issue:
1. In manage Connected App: Changed permitted user to "Permitted UsersAdmin approved users are pre-authorized"
2. Add profile of system Admin to Profiles