When using the JavaScript SDK to enable client side OAuth flow, I'm running into this issue: Uncaught TypeError: Cannot read properties of null (reading 'postMessage')

And the page gets stuck with the message Authorizing Application.

Authorizing Application

Steps to reproduce —

  1. Go to: https://api.stackexchange.com/docs/js-lib
  2. Scroll all the way down and click on the Run Example With Version 2.3 button
  3. Click on Approve to authorize your account

Cannot read properties of null

This is impacting my app as described here — Customizable, short URLs for Stack Overflow profiles

  • Seems like the login_success route fell victim to the, apparently, recent change in how pages are served, specifically, with a cross-origin-opener-policy header set to same-origin-allow-popups. window.opener gets nulled, and thus the code attempting to call postMessage, assuming that opener reference is available, tries to call it and crashes. Commented Jul 5, 2022 at 23:43

1 Answer 1


Looks like this has now been fixed. I don't know who did it or what did they do but THANK YOU, THANK YOU SO MUCH!

  • 1
    I'm facing the same issue, could you help me with how you solved it? The Run Example With Version 2.3 is working fine for me. But when I use Oauth with stackexchange.com as OAuth Domain & redirect_uri=https://stackexchange.com/oauth/login_success (as suggested here & here), i'm stuck at this page
    – Gangula
    Commented Sep 18, 2022 at 9:41

You must log in to answer this question.

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