Authentication integration - OIDC
This feature is available only in the AI Premium edition. For more information about different editions, see Version Introduction.
What is OIDC?
OIDC (OpenID Connect) is an authentication protocol built on top of OAuth 2.0. It complements OAuth 2.0 by standardizing features that the original specification left undefined. The authorization flows of both protocols are mostly identical, with two main differences:
The OIDC authorization flow returns an additional ID Token.
OIDC provides specifications for concepts that were not fully defined in OAuth 2.0, such as scope, service discovery, and user information fields.
How OIDC-based authentication integration works
To let users sign in to Alibaba Cloud Mail with your enterprise identity provider (IdP), the mail service and your IdP must exchange information by following the OIDC standard protocol.
The OIDC standard protocol supports multiple flows. This guide focuses on the authorization code grant.
Both the Alibaba Cloud Mail service and your enterprise IdP must implement the OIDC standard protocol. In this scenario, Alibaba Cloud Mail acts as the OIDC client, and your IdP acts as the OIDC server.
How to implement OIDC
For detailed information on implementing the OIDC authorization code grant, see the following standard protocol documents:
You must strictly follow the instructions in this document for any parts of the protocol that are loosely defined (see "Step 2: Configure the OIDC client in domain management" > "Check the prerequisites on the OIDC Configuration page").
OIDC login flow
Available modes
After configuration, you can choose from three modes.

Mode 1: Hybrid mode
Users can access your custom login address for Alibaba Cloud Mail and click the icon for your OIDC IdP under "More logon options".
When you first configure OIDC, you must use this mode for testing and verification to avoid disrupting user logins.

Mode 2: OIDC-first mode
When a user accesses the custom login address for your enterprise, they are automatically redirected to your enterprise IdP's login page.

In this mode, users can still bypass IdP authentication by signing in with their email and password on an official Alibaba Cloud Mail site.
Official Alibaba Cloud Mail sites:
China Site: https://qiye.aliyun.com/
Xinchuang Edition: https://mail.xc.aliyun.com/
Singapore Site: https://mail.sg.aliyun.com/
Hong Kong Site: https://mail.hk.aliyun.com/
Germany Site: https://mail.de.alibabacloud.com/
US Site: https://mail.us.alibabacloud.com/

Mode 3: OIDC-only mode
This mode is an enhanced version of the OIDC-first mode. Enabling it has two main effects:
Users can no longer sign in with their
emailcredentials on an official Alibaba Cloud Mail site. They are prompted to go to the company's designated login page to sign in through the enterprise IdP.

Standard protocols (IMAP, POP, and SMTP) no longer support authentication with
emailcredentials.For regular mailboxes accessed through clients like Outlook or Foxmail, users must create a security password in the webmail interface and use it to sign in.
For system mailboxes that use standard
emailprotocols in code to send automated emails, create a security password in the webmail interface and update the code to use it for authentication.
Enable this mode with caution. Because it affects standard protocols, ensure all mailboxes that rely on them have switched to using a security password before you proceed.

Procedure
Step 1: Create an OIDC client in your IdP
If your enterprise uses a self-hosted IdP, contact the relevant internal team to create an OIDC client for Alibaba Cloud Mail.
If your enterprise uses a third-party IDaaS product, follow that product's documentation to create an OIDC client.
Key configuration parameters:
Grant types for the token endpoint (
grant_type):authorization_code,refresh_tokenResponse type for the authorization endpoint (
response_type):codeToken endpoint authentication method:
client_secret_postID Token signing algorithm:
RS256Authorization code expiration: Recommended at least 600 seconds
ID Token expiration: Recommended 14 days (1,209,600 seconds)
Access token expiration: Recommended 14 days (1,209,600 seconds)
Refresh token expiration: Recommended 28 days (2,592,000 seconds)
(Recommended) Supported scopes:
openid,offline_access,email(Recommended) Supported claim:
emailRedirect URI: See the configuration page, as shown in the following figure.

Step 2: Configure the OIDC client in domain management
In Alibaba Cloud Mail domain management, navigate to Integration > Identity Source Management > Authentication Integration, and then click Start Configuration to open the Select Authentication Protocol page.

Click the OIDC identity source button to open the OIDC Configuration page.

On the OIDC Configuration page, check that you meet the prerequisites.

Condition | Description |
Required | |
Add a custom login address | Path: Domain > Login Address > Add Domain A custom login address is required to correctly route and redirect users to their enterprise OIDC IdP. |
Configure CNAME for the custom login address | Path: Domain > Login Address > CNAME Settings Ensures that your custom login address for Alibaba Cloud Mail functions correctly. |
Complete ICP filing for the custom login address | Path: Domain > Login Address > ICP Filing Settings Ensures that your custom login address for Alibaba Cloud Mail functions correctly. |
Recommended | |
Set the custom login address as the default link | Path: Domain > Login Address > Set as Functional Email Link In some scenarios, you may need to instruct employees to use the custom enterprise login address. |
Add an SSL certificate for the custom login address | Path: Domain > SSL Certificate Management > Upload Certificate Allows your custom login address to be accessed over HTTPS for enhanced security. |
Enforce HTTPS | Path: Domain > SSL Certificate Management > Enforce HTTPS Improves security by establishing an HTTPS connection by default when accessing the custom login address. |
Enforce security passwords for all users / Disallow third-party clients for all users | Path: 1. Security > Account Security > Password Policy > Enforce Security Password / Allow Third-party Clients 2. Security > Account Security > Access Policy > Disable Third-party Client Access Policy If you want to enable the Only allow login via this identity source option in the OIDC IdP configuration, you must enforce security passwords to ensure standard protocols (SMTP, IMAP, and POP) continue to function. Strongly recommended: Most account security issues stem from standard protocols. Enforcing security passwords or disabling third-party clients can eliminate these security risks and prevent account compromise or financial loss. Note: After you enforce security passwords, |
On the OIDC Configuration page, fill in the required fields.
Note: During the initial setup and testing phase, keep the Set as default login method option disabled to prevent service disruption for your employees.
Parameter | Description |
Basic configuration | |
Display Name | This name is displayed on the button on the user login page. |
Application Logo | This icon is displayed on the login page as the entry point for OIDC login. |
client ID | The client ID provided by your enterprise OIDC IdP. |
client secret | The client secret provided by your enterprise OIDC IdP. |
issuer URL | The issuer URL provided by your enterprise OIDC IdP. |
Redirect URI | You must add all of these URIs to the allowed redirect URIs in your enterprise OIDC IdP's configuration. |
Login configuration | |
Enable identity source | You must enable this switch to test or use this identity source for login. When enabled, an OIDC login button that uses this identity source is added to the login page. |
Set as default login method | When enabled, accessing your enterprise's custom login address for Alibaba Cloud Mail automatically redirects to your enterprise IdP's login page. Important: Before you enable this option, ensure that you can successfully sign in using this identity source. Otherwise, your employees will be unable to access their mailboxes. |
Only allow login via this identity source | We recommend that new enterprises enable this option. Existing enterprises with many active mailboxes should enable it with caution. When enabled, employees can only authenticate through this identity source. They cannot use other methods, such as their
Important: Ensure you have enforced security passwords for all users (go to Security > Account Security > Password Policy > Enforce Security Password). Otherwise, standard protocols and third-party clients (such as Outlook and Foxmail) will not work. |
After you complete the configuration, click Save.
If the configuration fails to save, check whether your issuer URL meets the requirements.

Note: For "Recommended" conditions, your enterprise OIDC IdP must implement the specified capabilities for the authentication flow to succeed, even if the issuer URL response does not list them.
Condition | Description |
Required | |
Must provide | The OIDC authorization endpoint, which is the login page URL of your enterprise OIDC IdP. |
Must provide | The OIDC token endpoint, used to exchange an authorization code for a token or a refresh token for a new access token. |
Must provide | The OIDC token endpoint returns an ID Token (in JWT format). The keys to parse the JWT are retrieved from the |
Recommended | |
Provide | Used to parse access token information, determine if the access token is valid, and get the current user's |
Provide | Used to exchange an access token for user information to get the current user's |
Provide | Used for browser-based logouts. Ensures that when a user signs out of Alibaba Cloud Mail, they are also signed out of their enterprise account. |
| The |
| The |
| The ID Token (in JWT format) returned by the OIDC token endpoint must include the |
| The scope parameter of the OIDC authorization endpoint request must support |
| The signing algorithm for the ID Token (in JWT format) returned by the OIDC token endpoint must support |
| The OIDC token endpoint must support client authentication by passing the client_id and client_secret parameters in the POST request body. |
| The OIDC introspection endpoint must support client authentication by passing the client_id and client_secret parameters in the POST request body. |
If PKCE is supported, | If your enterprise OIDC IdP supports PKCE, the code_challenge encoding method must support |
A typical response from an issuer URL should include at least the following information:
{
"authorization_endpoint": "https://mail.example.com/oidc/auth",
"token_endpoint": "https://mail.example.com/oidc/token",
"jwks_uri": "https://mail.example.com/oidc/.well-known/jwks.json",
"claims_supported": [
"email"
],
"code_challenge_methods_supported": [
"S256"
],
"end_session_endpoint": "https://mail.example.com/oidc/session/end",
"grant_types_supported": [
"authorization_code",
"refresh_token"
],
"response_types_supported": [
"code"
],
"scopes_supported": [
"openid",
"offline_access",
"email"
],
"token_endpoint_auth_methods_supported": [
"client_secret_post"
],
"userinfo_endpoint": "https://mail.example.com/oidc/me",
"introspection_endpoint": "https://mail.example.com/oidc/token/introspection",
"introspection_endpoint_auth_methods_supported": [
"client_secret_post"
],
"id_token_signing_alg_values_supported": [
"RS256"
]
}After you complete the configuration, click Save.
Step 3: Verify the integration
After you save the configuration, a confirmation message appears. Verify that you can successfully sign in to Alibaba Cloud Mail through your enterprise OIDC IdP.
Browser: Copy the address and open it in an incognito or private window. Click the OIDC icon to be redirected to your enterprise IdP to sign in.

