6

I'm using the JavaScript SDK by Stack Exchange provided with the latest API, and despite following the official instructions & examples it doesn't work - it seems there is a bug which breaks the workflow, and I believe it's on Stack Exchange's side.

The issue is that https://stackexchange.com/oauth/login_success never gets information about success/error of the authorization workflow, it just stays on the "Authorizing Application" step, never going further.

Further investigations show a Chrome Console output showing us a Uncaught TypeError: Cannot read property 'msie' of undefined jQuery error on Stack Exchange's login_success page:

login_success?assisted=8723&protocol=https&proxy=https://zendesk.mvink.me/integrations/stackexchang…:122 Uncaught TypeError: Cannot read property 'msie' of undefined
    at HTMLDocument.<anonymous> (login_success?assisted=8723&protocol=https&proxy=https://zendesk.mvink.me/integrations/stackexchang…:122)
    at i (jquery.min.js:2)
    at Object.fireWith [as resolveWith] (jquery.min.js:2)
    at Function.ready (jquery.min.js:2)
    at HTMLDocument.K (jquery.min.js:2)
(anonymous) @ login_success?assisted=8723&protocol=https&proxy=https://zendesk.mvink.me/integrations/stackexchang…:122
i @ jquery.min.js:2
fireWith @ jquery.min.js:2
ready @ jquery.min.js:2
K @ jquery.min.js:2

Looking into the source code, it seems you are using $.browser.msie && $.browser.version which has been deprecated in jQuery 1.9, and you are currently using jQuery 1.12 on this page.

// IE technically supports postMessage, but does a *really* bad job of it
if (window.postMessage && !($.browser.msie && $.browser.version <= '9.0')) {
    // modern browsers
    window.opener.postMessage(window.location.hash, 'https://zendesk.mvink.me');
} else {

The result is - success action is never passed to the host window (the one auth process has been called from), so it's not possible to get an access token back.

Please have a look into this.

  • 1
    Confirmed. And even SE's demo login fails with $.browser is undefined. – Brock Adams Jan 8 '17 at 16:22
  • 1
    This happened to me a few weeks ago and even adding the jquery migrate plugin to add browser didn't work. I thought it was a problem with my script but it seems not now. :/ This seems to be related to SE changing their jquery version maybe? – ᔕᖺᘎᕊ Jan 8 '17 at 17:07
4

Thanks for the report.

This has been fixed; for example you can see that the login demo is working properly again.

You must log in to answer this question.

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