|
2 | 2 | Microsoft Azure sign-in authentication |
3 | 3 | ====================================== |
4 | 4 |
|
5 | | -Due to specific requirements in Azure's OAuth implementation, Microsoft Azure OAuth identification |
6 | | -is NOT compatible with Odoo at the moment. |
| 5 | +The Microsoft Azure OAuth sign-in authentication is a useful function that allows Odoo users to sign |
| 6 | +in to their database with their Microsoft Azure account. |
| 7 | + |
| 8 | +This is particularly helpful if the organization uses Azure Workspace, and wants employees within |
| 9 | +the organization to connect to Odoo using their Microsoft Accounts. |
| 10 | + |
| 11 | +.. warning:: |
| 12 | + Databases hosted on Odoo.com should not use OAuth login for the owner or administrator of the |
| 13 | + database as it would unlink the database from their Odoo.com account. If OAuth is set up for that |
| 14 | + user, the database will no longer be able to be duplicated, renamed, or otherwise managed from |
| 15 | + the Odoo.com portal. |
| 16 | + |
7 | 17 |
|
8 | 18 | .. seealso:: |
9 | 19 | - :doc:`../../productivity/calendar/outlook` |
10 | 20 | - :doc:`/administration/maintain/azure_oauth` |
| 21 | + |
| 22 | +Configuration |
| 23 | +============= |
| 24 | + |
| 25 | +Integrating the Microsoft sign-in function requires configuration on Microsoft and Odoo. |
| 26 | + |
| 27 | +Odoo System Parameter |
| 28 | +--------------------- |
| 29 | + |
| 30 | +First activate the :ref:`developer mode <developer-mode>`, and then go to :menuselection:`Settings |
| 31 | +--> Technical --> System Parameters`. |
| 32 | + |
| 33 | +Click :guilabel:`Create` and on the new/blank form that appears, add the following system parameter |
| 34 | +`auth_oauth.authorization_header` to the :guilabel:`Key` field, and set the :guilabel:`Value` to |
| 35 | +`1`. Then click :guilabel:`Save` to finish. |
| 36 | + |
| 37 | +Microsoft Azure dashboard |
| 38 | +------------------------- |
| 39 | + |
| 40 | +Create a new application |
| 41 | +~~~~~~~~~~~~~~~~~~~~~~~~ |
| 42 | + |
| 43 | +Now that the system parameters in Odoo have been set up, it's time to create a corresponding |
| 44 | +application inside of Microsoft Azure. To get started creating the new application, go to |
| 45 | +`Microsoft's Azure Portal <https://portal.azure.com/>`_. Log in with the :guilabel:`Microsoft |
| 46 | +Outlook Office 365` account if there is one, otherwise, log in with a personal :guilabel:`Microsoft |
| 47 | +account`. |
| 48 | + |
| 49 | +.. important:: |
| 50 | + A user with administrative access to the *Azure Settings* must connect and perform the following |
| 51 | + configuration steps below. |
| 52 | + |
| 53 | +Next, navigate to the section labeled :guilabel:`Manage Azure Active Directory`. The location of |
| 54 | +this link is usually in the center of the page. |
| 55 | + |
| 56 | +Now, click on the :guilabel:`Add (+)` icon, located in the top menu, and then select :guilabel:`App |
| 57 | +registration` from the drop-down menu. On the :guilabel:`Register an application` screen, rename the |
| 58 | +:guilabel:`Name` field to `Odoo Login OAuth` or a similarly recognizable title. Under the |
| 59 | +:guilabel:`Supported account types` section select the option for :guilabel:`Accounts in this |
| 60 | +organizational directory only (Default Directory only - Single tenant)`. |
| 61 | + |
| 62 | +Under the :guilabel:`Redirect URL` section, select :guilabel:`Web` as the platform, and then input |
| 63 | +`https://<odoo base url>/auth_oauth/signin` in the :guilabel:`URL` field. The Odoo base :abbr:`URL |
| 64 | +(Uniform Resource Locator)` is the canonical domain at which your Odoo instance can be reached (e.g. |
| 65 | +*mydatabase.odoo.com* if you are hosted on Odoo.com) in the :guilabel:`URL` field. Then, click |
| 66 | +:guilabel:`Register`, and the application is created. |
| 67 | + |
| 68 | +Authentication |
| 69 | +~~~~~~~~~~~~~~ |
| 70 | + |
| 71 | +Edit the new app's authentication by clicking on the :guilabel:`Authentication` menu item in the |
| 72 | +left menu after being redirected to the application's settings from the previous step. |
| 73 | + |
| 74 | +Next, the type of *tokens* needed for the OAuth authentication will be chosen. These are not |
| 75 | +currency tokens but rather authentication tokens that are passed between Microsoft and Odoo. |
| 76 | +Therefore, there is no cost for these tokens; they are used merely for authentication purposes |
| 77 | +between two :abbr:`APIs (application programming interfaces)`. Select the tokens that should be |
| 78 | +issued by the authorization endpoint by scrolling down the screen and check the boxes labeled: |
| 79 | +:guilabel:`Access tokens (used for implicit flows)` and :guilabel:`ID tokens (used for implicit and |
| 80 | +hybrid flows)`. |
| 81 | + |
| 82 | +.. image:: azure/authentication-tokens.png |
| 83 | + :align: center |
| 84 | + :alt: Authentication settings and endpoint tokens. |
| 85 | + |
| 86 | +Click :guilabel:`Save` to ensure these settings are saved. |
| 87 | + |
| 88 | +Gather credentials |
| 89 | +~~~~~~~~~~~~~~~~~~ |
| 90 | + |
| 91 | +With the application created and authenticated in the Microsoft Azure console, credentials will be |
| 92 | +gathered next. To do so, click on the :guilabel:`Overview` menu item in the left-hand column. Select |
| 93 | +and copy the :guilabel:`Application (client) ID` in the window that appears. Paste this credential |
| 94 | +to a clipboard / notepad, as this credential will be used in the Odoo configuration later. |
| 95 | + |
| 96 | +After finishing this step, click on :guilabel:`Endpoints` on the top menu and click the *copy icon* |
| 97 | +next to :guilabel:`OAuth 2.0 authorization endpoint (v2)` field. Paste this value in the clipboard / |
| 98 | +notepad. |
| 99 | + |
| 100 | +The value should equal `https://login.microsoftonline.com/<directory_id>/oauth2/v2.0/authorize`. |
| 101 | +Replace the `<directory_id>` with the :guilabel:`Directory (tenant) ID` under the |
| 102 | +:guilabel:`Essentials` section of the *Overview* page if it is not already present in the :abbr:`URL |
| 103 | +(uniform resource locator)`. |
| 104 | + |
| 105 | +.. example:: |
| 106 | + Should the :guilabel:`Directory (tenant) ID` be equal to `6729e9df-afbb-4522-a876-f1408d416396` |
| 107 | + then the new value of the :guilabel:`OAuth 2.0 authorization endpoint (v2)` :abbr:`URL (Uniform |
| 108 | + Resource Locator)` should be: |
| 109 | + `https://login.microsoftonline.com/6729e9df-afbb-4522-a876-f1408d416396/oauth2/v2.0/authorize`. |
| 110 | + |
| 111 | +.. image:: azure/overview-azure-app.png |
| 112 | + :align: center |
| 113 | + :alt: Application ID and OAuth 2.0 authorization endpoint (v2) credentials. |
| 114 | + |
| 115 | +Odoo setup |
| 116 | +---------- |
| 117 | + |
| 118 | +Finally, the last step in the Microsoft Azure OAuth configuration is to configure some settings in |
| 119 | +Odoo. Navigate to :menuselection:`Settings --> Integrations --> OAuth Authentication` and check the |
| 120 | +box to activate the OAuth login feature. Click :guilabel:`Save` to ensure the progress is saved. |
| 121 | +Then, sign in to the database once the login screen loads. |
| 122 | + |
| 123 | +Once again, navigate to :menuselection:`Settings --> Integrations --> OAuth Authentication` and |
| 124 | +click on :guilabel:`OAuth Providers`. Now, select :guilabel:`New` in the upper-left corner and name |
| 125 | +the provider `Azure`. |
| 126 | + |
| 127 | +Paste the :guilabel:`Application (client) ID` from the previous section into the :guilabel:`Client |
| 128 | +ID` field. After completing this, paste the new :guilabel:`OAuth 2.0 authorization endpoint (v2)` |
| 129 | +value into the :guilabel:`Authorization URL` field. |
| 130 | + |
| 131 | +For the :guilabel:`UserInfo URL` field, paste the following :abbr:`URL (Uniform Resource Locator)`: |
| 132 | +`https://graph.microsoft.com/oidc/userinfo` |
| 133 | + |
| 134 | +In the :guilabel:`Scope` field, paste the following value: `openid profile email`. Next, the Windows |
| 135 | +logo can be used as the CSS class on the login screen by entering the following value: `fa fa-fw |
| 136 | +fa-windows`, in the :guilabel:`CSS class` field. |
| 137 | + |
| 138 | +Check the box next to the :guilabel:`Allowed` field to enable the OAuth provider. Finally, add |
| 139 | +`Microsoft Azure` to the :guilabel:`Login button label` field. This text will appear next to the |
| 140 | +Windows logo on the login page. |
| 141 | + |
| 142 | +.. image:: azure/odoo-provider-settings.png |
| 143 | + :align: center |
| 144 | + :alt: Odoo provider setup in the Settings application. |
| 145 | + |
| 146 | +:guilabel:`Save` the changes to complete the OAuth authentication setup in Odoo. |
| 147 | + |
| 148 | +User experience flows |
| 149 | +--------------------- |
| 150 | + |
| 151 | +For a user to log in to Odoo using Microsoft Azure, the user must be on the :menuselection:`Odoo |
| 152 | +password reset page`. This is the only way that Odoo is able to link the Microsoft Azure account and |
| 153 | +allow the user to log in. |
| 154 | + |
| 155 | +.. note:: |
| 156 | + Existing users must :ref:`reset their password <users/reset-password>` to access the |
| 157 | + :menuselection:`Odoo password reset page`. New Odoo users must click the new user invitation link |
| 158 | + that was sent via email, then click on :guilabel:`Microsoft Azure`. Users should not set a new |
| 159 | + password. |
| 160 | + |
| 161 | +To sign in to Odoo for the first time using the Microsoft Azure OAuth provider, navigate to the |
| 162 | +:menuselection:`Odoo password reset page` (using the new user invitation link). A password reset |
| 163 | +page should appear. Then, click on the option labeled :guilabel:`Microsoft Azure`. The page will |
| 164 | +redirect to the Microsoft login page. |
| 165 | + |
| 166 | +.. image:: azure/odoo-login.png |
| 167 | + :align: center |
| 168 | + :alt: Microsoft Outlook login page. |
| 169 | + |
| 170 | +Enter the :guilabel:`Microsoft Email Address` and click :guilabel:`Next`. Follow the process to sign |
| 171 | +in to the account. Should :abbr:`2FA (Two Factor Authentication)` be turned on, then an extra step |
| 172 | +may be required. |
| 173 | + |
| 174 | +.. image:: azure/login-next.png |
| 175 | + :align: center |
| 176 | + :alt: Enter Microsoft login credentials. |
| 177 | + |
| 178 | +Finally, after logging in to the account, the page will redirect to a permissions page where the |
| 179 | +user will be prompted to :guilabel:`Accept` the conditions that the Odoo application will access |
| 180 | +their Microsoft information. |
| 181 | + |
| 182 | +.. image:: azure/accept-access.png |
| 183 | + :align: center |
| 184 | + :alt: Accept Microsoft conditions for permission access to your account information. |
0 commit comments