AngellusMortis / django_microsoft_auth

Simple app to enable Microsoft Account, Office 365 and Xbox Live authentcation as a Django authentcation backend.
MIT License
137 stars 84 forks source link

Login into admin does not close the microsoft window and does not reload the page. #484

Closed Wissperwind closed 1 year ago

Wissperwind commented 2 years ago

Hi,

I just set up microsoft login. I try to login into django admin. The user was created by the plugin and I already gave him staff and admin permission by using a superuser. But the moment the microsoft login is completed, the window shows:

This window should automatically close. If it does not, it should be save to close after a few seconds.
{"microsoft_auth": {}}

But:

If close manually and afterwards refresh manually the user is logged in. But that can't be the way a user should log in.

abbas-mohd56 commented 2 years ago

I've been using this package for a while and started having this issue when I tried upgrading Django from 3.2 to 4.0. Since my project is already dependent on this package, I can't upgrade django until this bug is fixed .

Wissperwind commented 2 years ago

ok, so this is an django issue or an issue of this project?

korverdev commented 2 years ago

I did some digging into this. Django 4.0 added a security feature that breaks how this page was working. This change causes these two lines to error since window.opener is null.

Wissperwind commented 2 years ago

OK, and now?

sumitsandhir commented 2 years ago

H Guys, I have same issue as well. Is anyone working on it as i am using Django 4.1.3. Any suggestions?

bartTC commented 1 year ago

The solution in in the documentation link above. Set

# settings.py
SECURE_CROSS_ORIGIN_OPENER_POLICY = "none"

https://docs.djangoproject.com/en/4.1/ref/middleware/#cross-origin-opener-policy https://docs.djangoproject.com/en/4.1/ref/settings/#std-setting-SECURE_CROSS_ORIGIN_OPENER_POLICY

Wissperwind commented 1 year ago

Thank you. That solved my problem!!!