3

I'm playing around with the Stack Exchange API, and have just received my first response from the server using the "Hello World" example.

The next step is to allow the user to log in somehow. From the authentication documentation, I see that I should be using the implicit OAuth 2.0 flow. However, the instructions clearly say:

Open a new window at https://stackexchange.com/oauth/dialog

So, I assume that I must have a browser available to the user so that they can log in (be it through Google, an email address, etc.). Is this correct? If not, is it possible to create my own login screen using my own native UI, by communicating with the Stack Exchange API and authentication servers somehow?

  • 1
    Related: OAuth procedure for standalone user?. – Brock Adams Oct 30 '15 at 20:38
  • 1
    Your app must be able to: (1) make HTTPS GET requests to stackexchange.com, (2) parse the results, and (3) follow redirects. ... IIRC, if your app does not display the stackexchange.com/oauth/dialog page in a browser window, then it must be smart enough to act as a man-in-the-middle for the user's interaction with that page (plus any relevant iframes and redirects). – Brock Adams Oct 30 '15 at 20:47
  • Ok, great, so it is possible. It sounds kind of difficult though. How much work are talking about, to handle "iframes and redirects"? How do I know what input fields I need to display so that the user can enter their details? Is this where the OAuth API would come in? I don't really know where to begin. :) – Mitch Oct 30 '15 at 20:52
  • I haven't done it since OAuth(1) (All my current apps are browser based), but it can't be too hard, as people do it all day. Suggest you grab an OAuth2 API library for Google or Facebook or similar. I know they have them for the most popular languages... Make a test app for one of those sites that logs in... Then adjust the app to use the same techniques for the SE API... Then come back here and show how you did it... {magic happens here}... Profit! – Brock Adams Oct 30 '15 at 20:56
  • 1
    HA! Ok, will give it a try and come back with my results. :) – Mitch Oct 30 '15 at 20:59

You must log in to answer this question.

Browse other questions tagged .