title: Django Microsoft AD Authentication
body: <p>I noticed that this question was repeated few times, but still, from all the resources, I couldn't manage to make it work properly.</p>
  <p>I'm simply trying to use Azure Active Directory authentication with my Django app.
  I am using <a href="https://django-microsoft-auth.readthedocs.io/en/latest/usage.html#redirect-based-authentication-flow" rel="nofollow noreferrer">this</a> module, and I configured everything as noted in the docs.</p>
  <p>The thing is - I can't figure out where should user enter the credentials - since the module has only
  one url ('auth-callback/'). I can't find out how to jump to Microsoft login html page. Should I use my login.html or?</p>
  <p>Also, I guess that 'auth-callback/' url is obviously a callback URL, which comes after the login page.</p>
  <p>I am using django auth.views LoginView for login, and custom login.html page.</p>
  <p>In terms of Redirect URI's I configured redirect URI to match directly the 'http://localhost:8000/microsoft/auth-callback/' url, which is also how it needs to be I guess.</p>
  <p>Main problem is - where can I enter the credentials for login? :)</p>
  <p>Also, when I try this - I get invalid credentials error on my Admin login page :</p>
  <pre><code>Start site and go to /admin and logout if you are logged in.
  Login as Microsoft/Office 365/Xbox Live user. It will fail. This will automatically create your new user.
  Login as a Password user with access to change user accounts.
  </code></pre>
  <p>Quick Edit :</p>
  <p>I noticed that when i go to django/admin page '..../admin/login' inside the console i have this error :</p>
  <pre><code>https://static/microsoft/css/login.css Failed to load resource (404)
  https://static/microsoft/js/login.js Failed to load resource (404)
  </code></pre>
  <p>Where can i get those files?</p>
  <p>Let's jump to my code :</p>
  <ol>
  <li>settings.py</li>
  </ol>
  <pre><code>INSTALLED_APPS = [
      ...
      'django.contrib.sites',
      'microsoft_auth',
      ...
  ]
  
  #Choped from templates
  'context_processors': [
                  ...
                  'microsoft_auth.context_processors.microsoft',
              ],
  
  
  AUTHENTICATION_BACKENDS = [
      'microsoft_auth.backends.MicrosoftAuthenticationBackend',
      'django.contrib.auth.backends.ModelBackend',
  ]
  
  
  SITE_ID = 1
  
  
  LOGIN_REDIRECT_URL = 'main:index'
  LOGOUT_REDIRECT_URL = 'main:index'
  
  LOGIN_URL = '/'
  LOGOUT_URL = '/'
  
  # AZURE AUTH CONFIG
  MICROSOFT_AUTH_CLIENT_ID = 'THIS IS MY CLIENT KEY'
  MICROSOFT_AUTH_CLIENT_SECRET = 'THIS IS MY SECRET KEY'
  MICROSOFT_AUTH_TENANT_ID = 'THIS IS MY TENANT KEY'
  
  # include Microsoft Accounts, Office 365 Enterpirse and Azure AD accounts
  MICROSOFT_AUTH_LOGIN_TYPE = 'ma'
  
  </code></pre>
  <p>And my urls.py</p>
  <pre><code>...
      path('microsoft/', include('microsoft_auth.urls', namespace='microsoft')),
  ...
  
  </code></pre>
  <p>Thank you all in advance.</p>