django-allauth-microsoft

Microsoft OAuth2 provider for django-allauth


Keywords
django-allauth, oauth2
License
MIT
Install
pip install django-allauth-microsoft==1.0.3

Documentation

django-allauth-microsoft

Microsoft OAuth2 provider for django-allauth

Installation

requirements

python package

pip install django-allauth-microsoft

settings.py

The {tenant} value in the path of the request can be used to control who can sign into the application. The allowed values are tenant identifiers, for example, 8eaef023-2b34-4da1-9baa-8bc8c9d6a490 or contoso.onmicrosoft.com or common for tenant-independent tokens

INSTALLED_APPS = (
    ...
    # The following apps are required:
    'django.contrib.auth',
    'django.contrib.sites',

    'allauth',
    'allauth.account',
    'allauth.socialaccount',
     ...
     # Add allauth_microsoft to installed_apps
   	'allauth_microsoft'
     ...
)

SOCIALACCOUNT_PROVIDERS = {
    'microsoft': {
        'TENANT': '{tenant}',
    }
}

# Useful settings
# ACCOUNT_AUTHENTICATION_METHOD = 'email'
# ACCOUNT_EMAIL_REQUIRED = True
# ACCOUNT_EMAIL_VERIFICATION = 'none'

Post-Installation

register your application

  • Create your application on https://apps.dev.microsoft.com/
  • Callback is http://{hostname}/accounts/microsoft/login/callback/
  • Copy your Application Id
  • Create and Copy Application Secrets

Add Application Id Secrets as social application in django admin.

Contributors

License

MIT License