Today I went back to do some more work on the Salesforce Demo application that I have been presenting in my last few blog posts. When I ran the application and tried to login nothing would happen, the login was not completing for some reason even though the same code worked a few weeks ago. Doing some debugging I found I was getting the error “redirect_uri must match configuration” when I made the call to get the access token. The problem turned out to be with this line:
body.Append("redirect_uri = " + redirectURL);
It appears that the extra white space before and after the equals sign wasn’t a problem for Salesforce in the past, but it is now. Removing the white space fixes the problem.
body.Append("redirect_uri=" + redirectURL);