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 domain name. I hosted my application on free domain provided by `000webhost.com`. You may wish to take a similar approach.
        
After deploying the application on the domain, change the `oauth` domain and the application website on the app edit page. Also, keep in mind you have to link a valid stack apps post (a post made by you on stack apps) in the edit page.
        
This should work.