OAuthFlows icon indicating copy to clipboard operation
OAuthFlows copied to clipboard

User is never authorized

Open inakirzabalegui opened this issue 8 years ago • 5 comments

It does not matter how many times you validate the user through oauth2.0 User Server Flow, it always come back with "Some error occurred. Make sure connected app is approved previously. Salesforce Response : {"error":"invalid_grant","error_description":"user hasn't approved this consumer"}" I am analyzing myself why.

inakirzabalegui avatar Nov 28 '17 16:11 inakirzabalegui

I also got this error etheir. @JitendraZaa Could you help us to figure it out why it happen. Appreciate any suggestion from you

kvu-luong avatar Jul 29 '19 09:07 kvu-luong

Same same issue

manzanofab avatar Jan 31 '20 01:01 manzanofab

Go to policies of connected App and change setting to "Preauthorized user can login" Add that user's profile in Connected app policy. This should resolve issue.

JitendraZaa avatar Jan 31 '20 17:01 JitendraZaa

I tried Authorization many times but with no success; Finally , I went through the entire code and made a bit change in the Body where we pass the parameters :

Just change the order of parameters you are passing as given below

Old : Body(string iss,string aud,string prn,string exp){ this.iss=iss; this.aud=aud; this.prn=prn; this.exp=exp; }

New: Body(string iss,string prn,string aud,string exp){ this.iss=iss; this.aud=aud; this.prn=prn; this.exp=exp; }

Hope It works for you as well. Good Luck!

akshayshete88 avatar Aug 27 '20 14:08 akshayshete88

Go to policies of connected App and change setting to "Preauthorized user can login" Add that user's profile in Connected app policy. This should resolve issue.

Throwing below error with above setting: Some error occurred. Make sure connected app is approved previously. Salesforce Response : {"error":"invalid_request","error_description":"refresh_token scope is required and the connected app should be installed and preauthorized."} @JitendraZaa

sahasuman17 avatar Dec 25 '20 16:12 sahasuman17