Usage Scenario:
For the user who who cannot connect to the email using Outlook or Hotmail can use OAuth2 authentication to connect.
Steps to Create OAuth2
1. Access the Azure homepage
Access the Azure homepage: https://portal.azure.com/ and log in with your current Outlook email account.
2. Click Microsoft Entra ID
Click the portal menu bar and locate Microsoft Entra ID. If you encounter an error stating that the user does not exist, it means you need to activate a free Azure trial first. You can refer to here:
https://learn.microsoft.com/en-us/troubleshoot/entra/entra-id/app-integration/error-code-aadsts50020-user-account-identity-provider-does-not-exist then try again. If there's no error tip till step 3, then you can go further and no need to get the free trial.

3. Add an App registration


Name: Choose a name.
Redirect URI: Enter a URL that can handle the token; if you don’t have one, you can use AdsPower’s URL (how to get the token will be explained below).
4. Redirect URI & Certificate
After registration is complete, you need to configure the redirect URL, certificate (remember to save it; if you forget it, you’ll need to recreate it), and API permissions.



!!Note: Be sure to save this value, because after a while it will be hidden and cannot be viewed. It can be used to enter as the client secret
5. API Permissions
Enable all IMAP, POP, and SMTP permissions.



Follow the same steps for the other permissions. Then click Grant admin consent for Default Directory.

Done. So far, you have created an OAuth authenticator, and you can see the Client Id in the Overview.

Getting the refreshToken
AdsPowerRPA_Plus I'm sharing the task flow with you. To get the flow, navigate to AdsPower's RPA Plus [Processes] section, click the [Get process] button and enter the code: gP6QDt81B6YNL
In this step, there are 3 places that need to be modified:
1. Start Process
Fill in the Client ID and Client Secret (value) obtained from the steps above.

2. Email
Here you can obtain the current server port. After getting this port, you need to change the port in Execute JavaScript to match the obtained port.

3. Redirect URI
Redirect URI: Use the port number you get from the above step, change the relevant port number, and add it to Azure as a Redirect URI. Here is the URL: http://localhost:20409/api/rpav2/callback
For example, if you got the port number is 12339, then change the URL as http://localhost:12339/api/rpav2/callback then it can be used.

4. Run the process
Then run the workflow, and you will be able to get the token on the page.

This long string is the token information.