Make sure your application is set as a web application on the development portal. For the callback address there, make sure you use an incorrect address (like your application’s homepage), then specify the real address at runtime.
Web applications can use pin-based authentication, but desktop applications cannot use the web flow.