Django Microsoft Authentication Backend not succeeding on new deployments

168 views
Skip to first unread message

Larry Martell

unread,
Jan 22, 2021, 3:52:56 PM1/22/21
to django...@googlegroups.com
I have an app deployed in many places and it uses Django Microsoft Authentication Backend. Starting yesterday when we deploy the app the auth is now not working. We get back Failed to authenticate you for an unknown reason. Please try again later. We can see in the azure logs that the login was successful. We have the same version of Django Microsoft Authentication Backend installed, but for some reason on newly built boxes it is failing but older ones it is succeeding. What could be causing this? What can we check to track down what the issue may be?

Ryan Nowakowski

unread,
Jan 23, 2021, 11:15:12 AM1/23/21
to django...@googlegroups.com
A couple of places to look:

1. Different domains on the new boxes? You'll need to add the new callback urls on the Microsoft side.
2. Different version of Python on the new boxes?

Larry Martell

unread,
Jan 23, 2021, 2:06:44 PM1/23/21
to django...@googlegroups.com
On Sat, Jan 23, 2021 at 8:14 AM Ryan Nowakowski <tub...@fattuba.com> wrote:
>
> A couple of places to look:
>
> 1. Different domains on the new boxes? You'll need to add the new callback urls on the Microsoft side.
> 2. Different version of Python on the new boxes?

Same domain name, same version of python and all python packages.
There are some minor revision differences in a bunch of OS level
packages. Could that be a factor?

>
> On January 22, 2021 2:51:30 PM CST, Larry Martell <larry....@gmail.com> wrote:
>>
>> I have an app deployed in many places and it uses Django Microsoft Authentication Backend. Starting yesterday when we deploy the app the auth is now not working. We get back Failed to authenticate you for an unknown reason. Please try again later. We can see in the azure logs that the login was successful. We have the same version of Django Microsoft Authentication Backend installed, but for some reason on newly built boxes it is failing but older ones it is succeeding. What could be causing this? What can we check to track down what the issue may be?
>
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/963BCE7D-841C-4433-9081-55906AE11F31%40fattuba.com.

Ryan Nowakowski

unread,
Jan 23, 2021, 10:42:22 PM1/23/21
to django...@googlegroups.com
On Sat, Jan 23, 2021 at 11:05:14AM -0800, Larry Martell wrote:
> On Sat, Jan 23, 2021 at 8:14 AM Ryan Nowakowski <tub...@fattuba.com> wrote:
> >
> > A couple of places to look:
> >
> > 1. Different domains on the new boxes? You'll need to add the new callback urls on the Microsoft side.
> > 2. Different version of Python on the new boxes?
>
> Same domain name, same version of python and all python packages.
> There are some minor revision differences in a bunch of OS level
> packages. Could that be a factor?
>

Did you create your virtualenv with --system-site-packages? If not then
I don't think the OS packages will be a factor.

Larry Martell

unread,
Jan 29, 2021, 12:00:18 PM1/29/21
to django...@googlegroups.com
We finally found the issue - I said we had the same version of all the
python packages but we did not - the new system had 2.0.1 version of
pyjwt. When we downgraded to 1.7.1 it started working again. The
requirements file for Django Microsoft Authentication Backend have
pyjwt [required: Any]

Ryan Nowakowski

unread,
Jan 30, 2021, 1:31:13 PM1/30/21
to django...@googlegroups.com
On Fri, Jan 29, 2021 at 08:58:48AM -0800, Larry Martell wrote:
> We finally found the issue - I said we had the same version of all the
> python packages but we did not - the new system had 2.0.1 version of
> pyjwt. When we downgraded to 1.7.1 it started working again. The
> requirements file for Django Microsoft Authentication Backend have
> pyjwt [required: Any]

Yuuuuuup! That kind of thing has bitten me more than once. I end up
pinning the version of the dependency in requirements.txt to the one I
know works.
Reply all
Reply to author
Forward
0 new messages