I recently dealt with exactly this problem: everything matched, but it failed with the OAuthException. The thing that made it work was to change the redirect uri (in both requests for the flow) from:
to
I.e., add the trailing slash. And then it worked. Stupid and silly, but there you go.