When the using OAuth authentication on your instance Email Accounts, the job Refresh Email Access Token is associated to the "admin" user to have the admin role associated to work correctly.  

You will identify this problem because: 

  1. When the OAuth SMTP/IMAP/POP3 connection expires, the mail reader/sender connection is invalid:
    e.g. OAuth access token is not present or has expired. Email account=xxxxxx

  2. Instance node logs might show errors like
    worker.0 worker.0 txid=20038682db9b Name: Refresh Email Access Token
    worker.0 worker.0 txid=20038682db9b 6816f79cc0a8016401c5a33be04be441 can't read table oauth_credential

  3. Renewing the tokens manually with an admin account, it works correctly.
  4. Your "admin" user does not have the admin role
  5. Your Refresh Email Access Token jobs is associated to Run As: System Administrator (admin user)

connection failed


The scheduled job "Refresh Email Access Token" is configured to run as administrator (admin user).

  • If you have installed the OAuth Email plugin, the job is located here: <instance>/

The admin user would normally have access to the oauth_credential table via the admin role.
In this instance the admin role has been removed from the admin user

Job that needs admin


There are several recommended solutions:

  1. Restore the admin role to the admin user
  2. Customise the Refresh Email Access Token job to run with a user with the admin role
  3. Create relevant ACLs on oauth_credential table specifically granting access to a user, which you can use on the "Refresh Email Access Token" job

Article Information

Last Updated:2020-09-22 07:28:07