I faced the same issue when i was using the stack exchange API  to post a message to stack overflow website.
    
    I figured I had to post my application on a free domain name provided by some sites like 000webhost or heroku .After deploying the application on the domain , change the oauth domain and the application website on the app edit page . It will work. It worked for me .