Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
@Jonathan: I understand your suggestion and it makes sense. On the other hand, Firefox is also an application with an interface like any other. What matters here is the handling the HTTP requests, not so much the rendering of HTML (take for instance the w3m text-browser). So although I consider your advice, my point is to understand these processes and reproduce them programmatically, so embedding a ready-made browser wouldn't make much sense to me in this context.
@Jonathan: OK. It doesn't solve the initial problem though. Besides, if i'd proceed through the web-browser, I'd not be able to retrieve the access token at all, would I?
@Jonathan: you got me really confused here. In order to authorise an application, one needs to be logged in. What the script does is log in the user first--doing through the application's interface what one would do through the browser. Once one is logged in, the OAuth requests is made with the URL quoted above. I am also aware the user can register using different openID providers, the above is a draft using SE login only, but the final script would allow other IDs too.
Which value should I use in the OAuth Domain? From what I understand--since I am making a desktop application--I should use https://stackexchange.com/oauth/login_success.