Debian Codegraph @

docs/socialaccount/providers/microsoft.rst

raw
1 Microsoft
2 ---------
3
4 .. _ms-graph:
5
6 Microsoft Graph
7 ^^^^^^^^^^^^^^^
8
9
10 Microsoft Graph API is the gateway to connect to mail, calendar, contacts,
11 documents, directory, devices and more.
12
13 Apps can be registered (for consumer key and secret) here
14 https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationsListBlade
15
16 By default, ``common`` (``organizations`` and ``consumers``) tenancy is configured
17 for the login. To restrict it, change the ``tenant`` setting as shown below.
18
19 .. code-block:: python
20
21 SOCIALACCOUNT_PROVIDERS = {
22 "microsoft": {
23 "APPS": [
24 {
25 "client_id": "<insert-id>",
26 "secret": "<insert-secret>",
27 "settings": {
28 "tenant": "organizations",
29 # Optional: override URLs (use base URLs without path)
30 "login_url": "https://login.microsoftonline.com",
31 "graph_url": "https://graph.microsoft.com",
32 }
33 }
34 ]
35 }
36 }
37
38 .. note:: When you have configured your application to use single tenant authentication make sure to use the fragment above to set the ``"tenant"`` value to ``"organizations"`` in order to prevent the following error:
39
40 .. error:: AADSTS50194: Application 'application id' (application name) is not configured as a multi-tenant application. Usage of the /common endpoint is not supported for such applications created after '10/15/2018'. Use a tenant-specific endpoint or configure the application to be multi-tenant.
41
42
43 Microsoft Azure Entra (OpenID Connect)
44 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
45
46 For single instances of Microsoft Azure Entra, you should follow the
47 instructions at :ref:`ms-graph`.
48
49 If you want to use Microsoft Azure Entra as an OpenID Connect provider, e.g. to
50 support multiple Entra instances, follow the OpenID Connect provider
51 instructions, and configure the following in the settings:
52
53 .. code-block:: python
54
55 {
56 "server_url": "https://login.microsoftonline.com/common/v2.0",
57 "token_auth_method": "client_secret_basic"
58 }
59
60 - Make sure you change the ``common`` to your tenant id if you are using a single tenant.
61 - Make sure you added the ``v2.0`` to the end of the URL. Otherwise the email address won't be passed back.