+ Start a Discussion
BenedictBenedict 

OAuth: redirectURL mismatch error

Hi, I am doing OAuth in this simple HTML page:

 

<%@page import="static rest.RESTApp.*"%>
<html>
    <body onLoad="document.authorizationForm.submit()">
    <form action="<%=currentREST.getAuthURL()%>" method="post" name="authorizationForm">    
      <input type="hidden" name="response_type" value="code"/>    
      <input type="hidden" name="client_id" value="<%=currentREST.getClient_id()%>"/>
      <input type="hidden" name="redirect_url" value="<%=currentREST.getRedirect_url()%>"/>
    </form>
    </body>
</html>

 

I am getting an error "error=redirect_uri_mismatch&error_description=redirect_uri%20must%20match%20configuration" from salesforce server.

However, I checked several times the redirectURL and I am sure it is the same as in the REMOTE ACCESS configuration.

 

Can anyone tell me what am I doing wrong?

 

kennedymankennedyman

Have you tried to make sure the url is url encoded?

BenedictBenedict

Hi, I have used the URL encoded url:

https%3A%2F%2F10.132.35.240%3A8443%2F

 

and my original url as configured in the "remote access" section is:

https://10.132.35.240:8443/

 

but still, i'm getting the same error:

error=redirect_uri_mismatch&error_description=redirect_uri%20must%20match%20configuration

kennedymankennedyman

Hmmm, I'm not sure what to tell you then.

 

I just got that error the other day, and I found out I had the client id and the client secret incorrect. Make sure you're using the correct codes in those fields also.

 

Sorry I couldn't be more helpful.

BenedictBenedict

Hi, thank you all the same. I am quite sure that my client_id is correct (when I changed it to other values, an error saying that the client_id is not identified will occur). The client_secret is used only after the app get the access token, so I think it does not matter in the first round of communication.

 

This error is quite confusing though. I did totally as said in the REST API guide....