Send Mail using OAuth 2.O Authentication - Unattended


We wanted to add/call the Robocorp Standard “example-oauth-email” process/module
(GitHub - robocorp/example-oauth-email: E-mail authorization with OAuth2 flow) after the current main process for sending result files with outlook mail which eliminates control room intervention.

If we consider the case of Microsoft outlook mail. It has two tasks: Init OAuth Flow, Send Microsoft Email.
Do we need to run “Init OAuth Flow” Task always when using Send Microsoft Email Task? (or)
"Init OAuth Flow "Task needed to run only for the first time to get Auth code?

“Init OAuth Flow” Task opens a dialog- To enter authorization code. Will this cause any problems in control room? How can we handle this.

Please note that we wanted to remove human intervention (Unattended) for submitting any auth code etc.

Please correct me if I am missing something.

As per the policies, we are allowed to use only modern authorization for outlook emails.

Thanks for the support in advance.


  • Init OAuth Flow requires human intervention as you need to authenticate as an user (maybe you have MFA requirement as well – like a code confirmation on a device), then you need to authorize the app in the consent screen.
    • And now you end up with an auth code found in the address bar of the browser (redirect response URL).
    • This should be run on your computer (VSCode with Robocorp extension connected to Control Room and its Vault) or through an Assistant (once you replace the Work Item dependency with env vars for example).
    • It is enough to run it once, so it generates a token in the Vault.
  • Send Microsoft Email is unattended and requires the first step above already run so it has a token Vault entry generated in Control Room.
    • This can be run indefinitely from now on assuming that the token already exists in the Vault and that the refresh token didn’t get revoked nor the Client app removed.

For automating the auth code passing to the dialog, you should somehow capture it from the browser as soon as the flow finishes and then use that in the bot (without capturing it through the dialog anymore).
But since the user isn’t already logged in, human intervention is still required to do the user authentication. In this case:

Meanwhile, we’re working on an enhanced OAuth2 experience with the upcoming rpaframework==19.4.0 given the WIP Portal example change. Will update this as soon as it’s ready. (Dec 9th the latest)

Hello Cosmin,

And I tried the keywork as in rpaframework documenation :
Generate Oauth Url

And I get :
No keyword with name ‘Generate Oauth Url’ found

(I updated rpaframework : I’have 19.3.1).

Will this keyword be enable in 19.4.0 ?


Yes, that’s not released yet. Work in progress until this Friday.