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

OAuth: redirectURL mismatch error

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


<%@page import="static rest.RESTApp.*"%>
    <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()%>"/>


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?



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


Hi, I have used the URL encoded url:



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


but still, i'm getting the same error:



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.


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....