Generating the Authorization Code
Next, you must generate the authorization code, explained in the following steps:
-
Open the following URL in the browser after replacing
clientID
with the<client_id>
andredirect_uri
with the redirect URI of your application:https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=[clientid]&scope=IMAP.AccessAsUser.All%20POP.AccessAsUser.All%20SMTP.Send%20User.Read%20Mail.Read%20offline_access&response_type=code&redirect_uri=[redirect_uri]&prompt=login
NOTE
If there is the single tenant application, replacecommon
with your[tenantid]
in the following URL for generating authorization code:https://login.microsoftonline.com/[tenantid]/oauth2/v2.0/authorize?client_id=[[clientid]]&scope=IMAP.AccessAsUser.All%20POP.AccessAsUser.All%20SMTP.Send%20User.Read%20Mail.Read%20openid%20offline_access&response_type=code&redirect_uri=[redirect_uri]&prompt=login
-
When you type the above URL, you are redirected to the login screen:
-
Enter the email, click Next and the App permission screen appears:
-
When you allow permission, you are redirected to a new URL as:
https://login.microsoftonline.com/common/oauth2/nativeclient?code=<code>&session_state=[session_id]
-
Copy the value of
<code>
from the above URL from0.ASY...
to&session_state
in the above URL.
Generating the Refresh Token
Next, you must generate the refresh token, explained in the following steps:
-
Open the command prompt and use the following cURL command to get the refreshToken.
-
Replace the
clientID
,client_secret
, andredirect_uri
with the values for your application along with the value of<code>
:curl -H "ContentType application/x-www-form-urlencoded" -d "client_id=[client-id]&scope=https%3A%2F%2Foutlook.office.com%2FIMAP.AccessAsUser.All%20https%3A%2F%2Foutlook.office.com%2FPOP.AccessAsUser.All%20https%3A%2F%2Foutlook.office.com%2FSMTP.Send%20https%3A%2F%2Foutlook.office.com%2FUser.Read%20https%3A%2F%2Foutlook.office.com%2FMail.Read%20offline_access&code=[code]&grant_type=authorization_code&redirect_uri=[redirect_uri]&client_secret=[secretkey_value]" -X POST https://login.microsoftonline.com/common/oauth2/v2.0/token
NOTE
In single tenant application, to generate refresh token use the following cURL command and replacecommon
with the[tenantid]
in:curl -H "ContentType application/x-www-form-urlencoded" -d "client_id=[client-id]&scope=https%3A%2F%2Foutlook.office.com%2FIMAP.AccessAsUser.All%20https%3A%2F%2Foutlook.office.com%2FPOP.AccessAsUser.All%20https%3A%2F%2Foutlook.office.com%2FSMTP.Send%20https%3A%2F%2Foutlook.office.com%2FUser.Read%20https%3A%2F%2Foutlook.office.com%2FMail.Read%20offline_access&code=[code]&grant_type=authorization_code&redirect_uri=[redirect_uri]&client_secret=[secretkey_value]" -X POST https://login.microsoftonline.com/[tenantid]/oauth2/v2.0/token
-
Make note of the refresh token.
Configure E-mail Service with OAuth 2.0 Support
Now, configure the e-mail service at the latest JEE server by logging in to the Admin UI:
-
Go to Home > Service > Application and Services > Service Management > Email Service, the Configuration Email service window appears, configured for basic authentication.
NOTE
To enable oAuth 2.0 authentication service, it is mandatory to select Whether the SMTP server requires authentication (SMTP Authenticate) checkbox. -
Set oAuth 2.0 Authentication Settings as
True
. -
Copy the values of Client ID and Client Secret from Azure Portal.
-
Copy the value of the generated Refresh Token.
-
Login in to Workbench and search Email 1.0 from Activity Picker.
-
Three options are available under Email 1.0 as:
- Send with Document: Sends Email with single attachments.
- Send with Map of Attachments: Sends Email with multiple attachments.
- Receive: Receives an Email from IMAP.
NOTE
- The Transport Security protocol has the following valid values: ‘blank’, ‘SSL’ or ‘TLS’. Set values of SMTP Transport Security and Receive Transport Security to TLS for enabling the oAuth authentication service.
- POP3 protocol is not supported for OAuth while using email endpoints.
-
Test the application by selecting Send with Document.
-
Provide TO and From addresses.
-
Invoke the application and an email is sent using the 0Auth 2.0 authentication.
NOTE
If desired, you can change the Auth 2.0 authentication setting to basic authentication for a particular process in a workbench. To do so, set the OAuth 2.0 Authentication value as ‘False’ under Use Global settings in the Connection Settings tab.
To enable oAuth task notifications
-
Go to Home > Services > Form Workflow > Server Settings > Email Settings
-
To enable oAuth task notifications, select the Enable oAuth checkbox.
-
Copy the values of Client ID and Client Secret from Azure Portal.
-
Copy the value of the generated Refresh Token.
-
Click Save to save the details.
NOTE
To know more information related to task notifications, click here.
To configure email endpoint
-
Go to Home > Services > Application and Services > Endpoint Management
-
To configure email endpoint, set oAuth 2.0 Authentication Settings as
True
. -
Copy the values of Client ID and Client Secret from Azure Portal.
-
Copy the value of the generated Refresh Token.
-
Click Save to save the details.
NOTE
To know more information on configuring email endpoints, click Configure an email endpoint.
Troubleshooting
-
If the e-mail service is not working properly, try to regenerate the
Refresh Token
as described above. It takes a few minutes for the new value to be deployed. -
Error while configuring e-mail server details in email endpoint using Workbench. Try to configure the endpoint by way of the Admin UI instead of Workbench.
Experience Manager
Espressos & Experience Manager: AEM Forms
Espressos & Experience Manager
Thursday, Mar 6, 7:00 PM UTC
Join Adobe's AEM product team as they highlight AEM Forms' latest innovations, including: the new Gen AI Assistant, Unified Composition with AEM Sites, and new ways to deploy forms through conversations.
RegisterThe Future of Forms: Experience Success Across the Enrollment Journey
Adobe Experience Manager Forms is the conversion engine to fully capitalize on engagement and personalization efforts, yet it’s frequently...
Wed, Mar 19, 2:00 PM PDT (9:00 PM UTC)
Driving Marketing Agility and Scale: Transforming your Content Supply Chain with AI
Marketers everywhere are feeling the pressure to deliver impactful campaigns faster and at greater scale. This Strategy Keynote explores...
Tue, Mar 18, 2:30 PM PDT (9:30 PM UTC)
Connect with Experience League at Summit!
Get front-row access to top sessions, hands-on activities, and networking—wherever you are!
Learn more