Skip to content

Commit ddbe7cd

Browse files
committed
[IMP]Misc:Oauth-Azure
1 parent e1b675a commit ddbe7cd

File tree

8 files changed

+154
-2
lines changed

8 files changed

+154
-2
lines changed

content/applications/general/auth/azure.rst

Lines changed: 148 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,155 @@
22
Microsoft Azure sign-in authentication
33
======================================
44

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+
717

818
.. seealso::
919
- :doc:`../../productivity/calendar/outlook`
1020
- :doc:`/administration/maintain/azure_oauth`
21+
22+
Configuration
23+
=============
24+
25+
The integration of the Microsoft sign-in function requires configuration both 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+
Add in the following system parameter: `auth_oauth.authorization_header` and set the value to
34+
`1`.
35+
36+
Microsoft Azure dashboard
37+
-------------------------
38+
39+
Create a new application
40+
~~~~~~~~~~~~~~~~~~~~~~~~
41+
42+
To get started, go to `Microsoft's Azure Portal <https://portal.azure.com/>`_. Log in with the
43+
:guilabel:`Microsoft Outlook Office 365` account if there is one, otherwise log in with the
44+
personal :guilabel:`Microsoft account`. A user with administrative access to the Azure Settings
45+
will need to connect and perform the following configuration. Next, navigate to the section
46+
labeled :guilabel:`Manage Azure Active Directory`.
47+
48+
Now, click on :guilabel:`Add (+)`, located in the top menu, and then select :guilabel:`App
49+
registration`. On the :guilabel:`Register an application` screen, rename the :guilabel:`Name` to
50+
`Odoo` or something recognizable. Under the :guilabel:`Supported account types` either the selection
51+
for personal accounts or enterprise access (only users from the companies directory) can be
52+
selected. To include both select :guilabel:`Accounts in any organizational directory (Any Azure AD
53+
directory - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)`.
54+
55+
Under the :guilabel:`Redirect URL` section, select :guilabel:`Web` as the platform, and then input
56+
`https://<odoo base url>/auth_oauth/signin` in the :guilabel:`URL` field. The Odoo base
57+
:abbr:`URL (Uniform Resource Locator)` is the canonical domain at which your Odoo instance can be
58+
reached (e.g. mydatabase.odoo.com if you are hosted on Odoo.com) in the :abbr:`URL (Uniform Resource
59+
Locator)` field. Then, click :guilabel:`Register` and the application is created.
60+
61+
Authentication
62+
~~~~~~~~~~~~~~
63+
64+
Edit the new app's authentication by clicking on :guilabel:`Authentication` after being redirected
65+
to the application's settings from the previous step.
66+
67+
Select the *tokens* that should be issued by the authorization endpoint by scrolling down the screen
68+
and check the boxes labeled: :guilabel:`Access tokens (used for implicit flows)` and :guilabel:`ID
69+
tokens (used for implicit and hybrid flows)`.
70+
71+
.. image:: azure/authentication-tokens.png
72+
:align: center
73+
:alt: Authentication settings and endpoint tokens.
74+
75+
Click :guilabel:`Save` to ensure these settings are saved.
76+
77+
Gathering credentials
78+
~~~~~~~~~~~~~~~~~~~~~
79+
80+
Next, click on the :guilabel:`Overview` menu item in the left hand column. Select and copy the
81+
:guilabel:`Application (client) ID`. Paste this credential to a clipboard/notepad as this credential
82+
will be used in the Odoo configuration later.
83+
84+
After finishing this step, click on :guilabel:`Endpoints` on the top menu and click the *copy icon*
85+
next to :guilabel:`OAuth 2.0 authorization endpoint (v2)`.
86+
87+
The value should equal `https://login.microsoftonline.com/common/oauth2/v2.0/authorize`. Replace the
88+
`common` with the :guilabel:`Directory (tenant) ID` under the :guilabel:`Essentials` section of the
89+
Overview page.
90+
91+
.. example::
92+
Should the :guilabel:`Directory (tenant) ID` be equal to `6729e9df-afbb-4522-a876-e1408d416396`
93+
then the new value of the :guilabel:`OAuth 2.0 authorization endpoint (v2)` :abbr:`URL (Uniform
94+
Resource Locator)` should be:
95+
`https://login.microsoftonline.com/6729e9df-afbb-4522-a876-e1408d416396/oauth2/v2.0/authorize`.
96+
97+
.. image:: azure/overview-azure-app.png
98+
:align: center
99+
:alt: Application ID and OAuth 2.0 authorization endpoint (v2) credentials.
100+
101+
Odoo setup
102+
----------
103+
104+
Navigate to :menuselection:`Settings --> Integrations --> Oauth Authentication` and check the box to
105+
activate the Oauth login feature. Click :guilabel:`Save` to ensure the progress is saved. Sign into
106+
database once the login screen loads.
107+
108+
Navigate back to :menuselection:`Settings --> Integrations --> Oauth Authentication` and click on
109+
:guilabel:`Oauth Providers`. Next, select :guilabel:`New` and name the provider `Azure`.
110+
111+
Paste the :guilabel:`Application (client) ID` from the previous section into the :guilabel:`Client
112+
ID` field. After completing this, paste the new :guilabel:`OAuth 2.0 authorization endpoint (v2)`
113+
value into the :guilabel:`authorization URL` field.
114+
115+
For the :guilabel:`UserInfo URL` field, paste the following :abbr:`URL (Uniform Resource Locator)`:
116+
`https://graph.microsoft.com/oidc/userinfo`
117+
118+
In the :guilabel:`Scope` field, paste the following value: `openid profile email`. Next, the
119+
Windows logo can be used as the CSS class by entering the following value (`fa-fw fa-windows`) in
120+
the :guilabel:`CSS class` field.
121+
122+
Check the box next to the :guilabel:`Allowed` field to enable the Oauth provider. Finally add
123+
`Microsoft Azure Login` to the :guilabel:`Login button label` field.
124+
125+
.. image:: azure/odoo-provider-settings.png
126+
:align: center
127+
:alt: Odoo provider setup in the Settings application.
128+
129+
:guilabel:`Save` the changes should this step be required by the version of Odoo.
130+
131+
User experience flows
132+
---------------------
133+
134+
To sign-in using the Microsoft Azure Oauth provider navigate to the Odoo database login page and
135+
click on the option labeled :guilabel:`Microsoft Azure Login`. The page will redirect to the
136+
Microsoft login page.
137+
138+
.. image:: azure/odoo-login.png
139+
:align: center
140+
:alt: Microsoft Outlook login page.
141+
142+
Enter the :guilabel:`Microsoft Email Address` and click :guilabel:`Next`. Follow the process to
143+
sign-in to the account. Should :abbr:`2FA (Two Factor Authentication)` be turned on an extra step may
144+
be required.
145+
146+
.. image:: azure/login-next.png
147+
:align: center
148+
:alt: Enter Microsoft login credentials.
149+
150+
Finally after logging into the account the page will redirect to a permissions page where the user
151+
will be prompted to :guilabel:`Accept` the conditions that the Odoo application will access their
152+
Microsoft information.
153+
154+
.. image:: azure/accept-access.png
155+
:align: center
156+
:alt: Accept Microsoft conditions for permissions access to your account information.
26 KB
Loading
24.8 KB
Loading
12 KB
Loading
23.8 KB
Loading
15.2 KB
Loading
26.5 KB
Loading

content/applications/general/auth/google.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ database with their Google account.
88
This is particularly helpful if the organization uses Google Workspace, and wants employees within
99
the organization to connect to Odoo using their Google Accounts.
1010

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+
1117
.. seealso::
1218
- :doc:`/applications/productivity/calendar/google`
1319
- :doc:`/administration/maintain/google_oauth`

0 commit comments

Comments
 (0)