Microsoft Azure sign-in authentication¶
The Microsoft Azure OAuth sign-in authentication is a useful function that allows Odoo users to sign in to their database with their Microsoft Azure account.
This is particularly helpful if the organization uses Azure Workspace, and wants employees within the organization to connect to Odoo using their Microsoft Accounts.
Cảnh báo
Các cơ sở dữ liệu được lưu trữ trên Odoo.com không nên sử dụng đăng nhập OAuth cho chủ sở hữu hoặc quản trị viên của cơ sở dữ liệu, vì điều này sẽ làm ngắt kết nối cơ sở dữ liệu với tài khoản Odoo.com của họ. Nếu OAuth được thiết lập cho người dùng đó, cơ sở dữ liệu sẽ không thể được sao chép, đổi tên hoặc quản lý theo cách khác từ cổng thông tin Odoo.com.
Cấu hình¶
Integrating the Microsoft sign-in function requires configuration on Microsoft and Odoo.
Tham số hệ thống Odoo¶
First activate the developer mode, and then go to .
Click Create and on the new/blank form that appears, add the following system parameter
auth_oauth.authorization_header
to the Key field, and set the Value to
1
. Then click Save to finish.
Trang chủ Microsoft Azure¶
Tạo một ứng dụng mới¶
Bây giờ khi các tham số hệ thống trong Odoo đã được thiết lập, đã đến lúc tạo một ứng dụng tương ứng trong Microsoft Azure. Để bắt đầu tạo ứng dụng mới, hãy truy cập vào Cổng thông tin Azure của Microsoft. Đăng nhập bằng tài khoản Microsoft Outlook Office 365 nếu có, nếu không, hãy đăng nhập bằng tài khoản cá nhân Microsoft.
Quan trọng
A user with administrative access to the Azure Settings must connect and perform the following configuration steps below.
Next, navigate to the section labeled Manage Microsoft Entra ID (formally Azure Active Directory). The location of this link is usually in the center of the page.
Bây giờ, nhấp vào biểu tượng Thêm (+) ở menu phía trên, sau đó chọn Đăng ký ứng dụng từ menu thả xuống. Trên màn hình Đăng ký ứng dụng, đổi tên trường Tên thành OAuth đăng nhập Odoo
hoặc tiêu đề tương tự dễ nhận biết. Trong phần Loại tài khoản được hỗ trợ, chọn tùy chọn Chỉ tài khoản trong thư mục tổ chức này (Chỉ thư mục mặc định - Chỉ một khách thuê).
Cảnh báo
The Supported account types can vary by Microsoft account type and end use of the OAuth. For example: Is the login meant for internal users within one organization or is it meant for customer portal access? The above configuration is used for internal users in an organization.
Choose Personal Microsoft accounts only if the target audience is meant for portal users. Choose Accounts in this organizational directory only (Default Directory only - Single tenant) if the target audience is company users.
Trong phần URL chuyển hướng, chọn Web làm nền tảng, sau đó nhập https://<odoo base url>/auth_oauth/signin
vào trường URL. URL cơ sở của Odoo là tên miền chính thức để truy cập phiên bản Odoo của bạn (VD: mydatabase.odoo.com nếu bạn được lưu trữ trên Odoo.com) trong trường URL. Sau đó, nhấp Đăng ký để tạo ứng dụng.
Xác thực¶
Edit the new app's authentication by clicking on the Authentication menu item in the left menu after being redirected to the application's settings from the previous step.
Tiếp theo, loại token cần thiết cho xác thực OAuth sẽ được chọn. Đây không phải là token tiền tệ mà là token xác thực được truyền giữa Microsoft và Odoo. Do đó, không mất phí cho các token này; chúng chỉ được sử dụng cho mục đích xác thực giữa hai API. Chọn các token sẽ được cấp bởi endpoint ủy quyền bằng cách cuộn xuống màn hình và đánh dấu vào các ô có nhãn: Token truy cập (được sử dụng cho các chu trình ngầm) và Token ID (được sử dụng cho các chu trình ngầm và hybrid).

Click Save to ensure these settings are saved.
Gather credentials¶
Sau khi tạo và xác thực ứng dụng trong bảng điều khiển Microsoft Azure, bước tiếp theo là thu thập thông tin xác thực. Để thực hiện, nhấp vào mục menu Tổng quan ở cột bên trái. Chọn và sao chép ID ứng dụng (máy khách) trong cửa sổ hiển thị. Dán thông tin xác thực này vào bộ nhớ tạm/notepad, vì sẽ sử dụng nó để cấu hình Odoo sau này.
After finishing this step, click on Endpoints on the top menu and click the copy icon next to OAuth 2.0 authorization endpoint (v2) field. Paste this value in the clipboard / notepad.

Thiết lập Odoo¶
Bước cuối cùng trong cấu hình OAuth của Microsoft Azure là thiết lập một số cài đặt trong Odoo. Đi đến Lưu để đảm bảo tiến trình được lưu lại. Sau đó, đăng nhập vào cơ sở dữ liệu khi màn hình đăng nhập được tải.
và tích vào ô để kích hoạt tính năng đăng nhập OAuth. NhấpOnce again, navigate to OAuth Providers. Now, select New in the upper-left corner and name
the provider Azure
.
Paste the Application (client) ID from the previous section into the Client ID field. After completing this, paste the new OAuth 2.0 authorization endpoint (v2) value into the Authorization URL field.
For the UserInfo URL field, paste the following URL:
https://graph.microsoft.com/oidc/userinfo
In the Scope field, paste the following value: openid profile email
. Next, the Windows
logo can be used as the CSS class on the login screen by entering the following value: fa fa-fw
fa-windows
, in the CSS class field.
Check the box next to the Allowed field to enable the OAuth provider. Finally, add
Microsoft Azure
to the Login button label field. This text will appear next to the
Windows logo on the login page.

Save the changes to complete the OAuth authentication setup in Odoo.
User experience flows¶
For a user to log in to Odoo using Microsoft Azure, the user must be on the
. This is the only way that Odoo is able to link the Microsoft Azure account and allow the user to log in.Ghi chú
Existing users must reset their password to access the . New Odoo users must click the new user invitation link that was sent via email, then click on Microsoft Azure. Users should not set a new password.
To sign in to Odoo for the first time using the Microsoft Azure OAuth provider, navigate to the Microsoft Azure. The page will redirect to the Microsoft login page.
(using the new user invitation link). A password reset page should appear. Then, click on the option labeled
Enter the Microsoft Email Address and click Next. Follow the process to sign in to the account. Should 2FA be turned on, then an extra step may be required.

Finally, after logging in to the account, the page will redirect to a permissions page where the user will be prompted to Accept the conditions that the Odoo application will access their Microsoft information.
