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
clahavclahav 

auth failure- {"error":"invalid_grant","error_description":"invalid authorization code"}

experts

request for auth token and fails

i am using a webservice request to trigger an auth request. the call back is handled by a different method in the same webservice.

firewall? trusted remote site?

 

webservice call trigger: https://localhost:8443/auth_example/beginauth

HttpPost("https://cs2.salesforce.com/services/oauth2/token");//domain of sandbox

 

"client_id", "XXX"
"client_secret", "YYY"
"grant_type", "authorization_code"
"response_type", "code"

"redirect_uri", "https://localhost:8443/auth_example/auth/authcallback"//redirecturi is registered as remote site call back

 

what's am i missing?

 

thnaks

Eric BowdenEric Bowden

clahav, which of the OAuth authentication flows are you using, http://na14.salesforce.com/help/doc/en/remoteaccess_authenticate.htm ?

 

It looks like you are using the OAuth 2.0 Web Server Authentication Flow, http://na14.salesforce.com/help/doc/en/remoteaccess_oauth_web_server_flow.htm.  Making that assumption, it then looks like you are at step 3.  At this point you should have a valid authorization code in hand and are making a call to obtain the access token.  From your pseudo code, it looks like you are not sending the authorization code as the code parameter.  Also, for that call, I don't believe you should send a response_type parameter.

 

I might be able to help more if you can confirm which flow you are using and which step in the flow you are trying to execute.

 

clahavclahav

thanks for the reply

i am now using auth user psw flow

i set up a mock remote site to generate key+secret to generate token and i am able to get info [rest] but i cant post...

any idea why ??

 

thanks