我正在为已安装的应用程序使用OAuth 2流程。应用程序重定向用户进行身份验证。在进行身份验证后,用户会授权我的应用程序访问其帐户。浏览器从不加载下一页,我在调试控制台中看到了Javascript类型错误。
重现问题的步骤:
预期输出 浏览器应该使用标题中的身份验证代码加载页面。
实际结果
接受和取消按钮都被禁用,单击它们无效。该脚本应检查浏览器的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
答案 0 :(得分:0)
试试这个:
(1)从url中删除下一个:
<a href="{% url 'social:begin' 'google-oauth2' %}?next={{ request.path }}">Login with Google</a>
是这样的:
<a href="{% url 'social:begin' 'google-oauth2' %}">Login with Google</a>
(2)将LOGIN_REDIRECT_URL设置为正确的值(在设置文件中):
像:
LOGIN_REDIRECT_URL = 'login_success'
#'login_success' is a url name, change it to your valid url name