2

Assuming I've created an app that authenticates the user against api-v2, is there a method to get a token or cookie that I can pass to a browser instance set to load a stack exchange site that will auto log the authenticated user into the site?

Until the write API is complete, it seems the best method to allow my users to fully interact with stack exchange without leaving my app is to include a browser with custom CSS and javascript.

For the purposes of discussion, the app can be considered a native app on a mobile device.

Right now it looks like I would have to authenticate the user, then give them a browser window and allow them to authenticate again against the website, then look at the returned html to determine if they've logged into the same account, then store the relevant cookies and data.

4
  • Thinking on this, the use case is valid but the "with token, force login" behavior is... scary. I think some tweaks to global login may be sufficient, so that authenticating an app would effectively log you into all sites (upon first hit to them anyway). Dec 27, 2011 at 20:30
  • @KevinMontrose Hmm. That makes sense. So pushing the user through the api authentication process would provide the browser with the same cookies/data that a normal site login would provide, so future interactions inside that same browser would be with that user account. That makes sense.
    – Adam Davis
    Dec 27, 2011 at 23:13
  • Doesn't authenticating an app already require you to be logged in? Dec 28, 2011 at 17:38
  • 1
    @George - to stackexchange.com; not any other site in the network. Auto-login seems the way to go here, will probably knock out the required tweaks early next week; it's a bit big to work on while on "vacation". Dec 29, 2011 at 0:04

2 Answers 2

1

This has been completed for rather a while now.

When authorizing a user via OAuth, we attach a global auth session. If a user is subsequently directed to a site, they should automatically log in without any action by application.

2
  • Kevin, I just posted (and deleted) a question on MSO because this doesn't work, at least it doesn't on my android. I'm using Stack-Remote and I have to login to the browser when redirected.
    – GUI Junkie
    Jan 4, 2013 at 9:54
  • I suppose you have enough rep to see the question: meta.stackoverflow.com/questions/161453/…
    – GUI Junkie
    Jan 4, 2013 at 9:55
0

Why not provide the site login first? Then when they've logged in through that, show the API auth dialog, which will use the cookies/etc from the initial login, so the user will only have to press accept or reject and won't have to login again.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .