Redirect_uri does not match registered URI

I had a similar problem. It turned out that I had to be making my request from the page I defined as my registered URI…

I think the JS API checks:
window.location == redirect_uri

in order to verify that requests sent to the service are legit.