我正在为已安装的应用程序使用 OAuth 2 流程。应用程序重定向用户进行身份验证。验证用户身份后,授权我的应用程序访问他们的帐户。浏览器从不加载下一页,我在调试控制台中看到 Javascript 类型错误。
重现问题的步骤:
- 将用户定向到 https://accounts.google.com/o/oauth2/auth,并将 redirect_uri 设置为越界 (urn:ietf:wg:oauth:2.0:oob)
- 身份验证工作正常
- 单击授权页面上的接受按钮后,脚本会引发 TypeError
预期输出: 浏览器应加载标题中包含身份验证代码的页面。
实际结果:Accept和Cancel按钮
都被禁用,单击它们没有任何效果。该脚本应检查该sessionStorage
属性是否在浏览器的window
对象中可用。
这是调试控制台的输出:
TypeError: Result of expression 'window.sessionStorage' [undefined] is not an object.
at https://apis.google.com/_/scs/abc-static/_/js/k=gapi.gapi.en.a0irxetnvx4.O/m=googleapis_client,plusone/exm=appcirclepicker/rt=j/sv=1/d=1/ed=1/am=EA/rs=AItRSTMM3Tduq30stOAPMPXAx0A6ctSSsg/cb=gapi.loaded_1 : 13
at https://apis.google.com/_/scs/abc-static/_/js/k=gapi.gapi.en.a0irxetnvx4.O/m=googleapis_client,plusone/exm=appcirclepicker/rt=j/sv=1/d=1/ed=1/am=EA/rs=AItRSTMM3Tduq30stOAPMPXAx0A6ctSSsg/cb=gapi.loaded_1 : 18
at https://ssl.gstatic.com/gb/js/smm_f3709b68f5d2f2cb75de9df3f7819c89.js : 151
at https://ssl.gstatic.com/gb/js/smm_f3709b68f5d2f2cb75de9df3f7819c89.js : 154
at https://ssl.gstatic.com/gb/js/smm_f3709b68f5d2f2cb75de9df3f7819c89.js : 151
at https://ssl.gstatic.com/gb/js/smm_f3709b68f5d2f2cb75de9df3f7819c89.js : 153
at https://ssl.gstatic.com/gb/js/smm_f3709b68f5d2f2cb75de9df3f7819c89.js : 153
at https://ssl.gstatic.com/gb/js/smm_f3709b68f5d2f2cb75de9df3f7819c89.js : 153
at https://ssl.gstatic.com/gb/js/smm_f3709b68f5d2f2cb75de9df3f7819c89.js : 153