Troubleshooting Entra ID attributes not updating in email signatures (expired OAuth tokens)
Problem:
Your users’ email signatures contain outdated information that doesn’t match the corresponding attributes in your organization’s Microsoft Entra ID (Azure Active Directory). CodeTwo Admin Panel shows a warning that your OAuth 2.0 access tokens have expired (Fig. 1.), and you receive an email notification from CodeTwo asking you to refresh them.
![]()
Fig. 1. CodeTwo Admin Panel shows that OAuth 2.0 access tokens have expired.
Solution:
CodeTwo uses OAuth 2.0 access tokens to read Entra ID attribute values and insert them into email signatures. If these tokens expire, you need to refresh them in CodeTwo Admin Panel to keep your signatures up to date. See this article to learn how to refresh your OAuth 2.0 tokens.
If the problem persists and your tokens expire regularly or unexpectedly, read on to find out why it happens and learn how to resolve the issue.
Why your OAuth 2.0 access tokens expire
OAuth 2.0 access tokens may expire for any of the following reasons:
- The Microsoft 365 admin account used to generate or refresh the tokens has been modified or is no longer available. This is usually the global admin account used to manage your tenant in CodeTwo Admin Panel or a global admin or privileged role admin account previously used to refresh your tokens. The problem typically occurs when:
- that admin’s password has been changed,
- the authentication method for that admin account has changed (for example, multi-factor authentication has been enabled or disabled),
- the admin account has been deleted from your tenant.
- Your organization’s security settings have changed.
- Multi-factor authentication (MFA) service settings for trusted devices require users to re-authenticate frequently.
Since most of these causes are related to restrictive authentication policies, you can try the following solutions to resolve your token expiration issues:
- Refresh your tokens using an account with fewer security restrictions
- Modify MFA service settings for trusted devices
Tip
To avoid synchronization- or token-related problems, consider using CodeTwo’s Attributes manager. Our tool not only lets you bulk edit Entra ID (Azure AD) attributes used in email signatures, disclaimers, and auto replies, but also easily create custom attributes that match your use cases.
What’s important, all the changes made in the Attributes manager are instantly synced in your email signatures without the need to use access tokens to read Entra ID data. These changes do not affect your original Entra ID data, too – all the information that you manage in the Attributes manager is stored only in Entra ID CodeTwo cache.
Refresh tokens using an account with fewer security restrictions
To reduce the risk of repeated token expiration, you can use an account that is not affected by certain security policies. These include policies that require users to sign in again regularly or change their account credentials or authentication methods. For this purpose, you need to assign the Privileged Role Administrator role to that account. To follow the principle of least privilege, you can revoke this role immediately after refreshing the tokens – removing admin permissions from an account previously used to refresh or generate access tokens doesn’t cause those tokens to expire.
Here’s how to do this step by step:
- Sign in to the Microsoft Entra admin center using a global admin or privileged role admin account.
- Go to Entra ID > Users > All users and select the account to which you want to assign the Privileged Role Administrator role.
Tip
To make sure this account isn’t subject to restrictive authentication policies that could lead to token expiration, consider checking:
- the password expiration policy set for this account, as described in this Microsoft article,
- existing Microsoft Entra Conditional Access policies.
- Go to Assigned roles and click Add assignments (Fig. 2.).
![]()
Fig. 2. Assigning a role to a user account in the Microsoft Entra admin center.
- In the Add assignments window that opens, expand the Select role drop-down list and select Privileged Role Administrator (Fig. 3.). Click Next to continue.
![]()
Fig. 3. Assigning the Privileged Role Administrator role to a user.
- On the Settings tab, choose the assignment type:
- Eligible – requires the user to activate the role before using it by performing an MFA check, requesting for approval, or providing a justification.
- Active – allows the user to use the role without activating it first. Depending on your organization’s settings, you may also need to provide a justification.
- (Optional) Specify the assignment’s duration – to do that, clear the Permanently assigned checkbox and enter the assignment’s start and end dates.
- Click Assign to add the configured role assignment (Fig. 4.).
![]()
Fig. 4. Completing the role assignment in the Microsoft Entra admin center.
- Use the account with the assigned Privileged Role Administrator role to refresh your OAuth 2.0 access tokens in CodeTwo Admin Panel, as described in this article.
- If needed, you can now remove the Privileged Role Administrator role from the account used to refresh the tokens. To do this, go back to the account’s page in the Microsoft Entra admin center, select Assigned roles from the left menu, choose either the Eligible assignments or Active assignments tab (depending on the assignment type selected in step 5 above), and click Remove in the relevant row, as shown in Fig. 5.
Important
You need to wait at least 5 minutes after assigning a role before you can remove it.
![]()
Fig. 5. Removing the Privileged Role Administrator role assignment in the Microsoft Entra admin center.
- To verify that your refreshed access tokens work as expected, it’s a good idea to check their status after 24 hours. To do that, sign in to CodeTwo Admin Panel, select your tenant on the Tenants page, and go to Tokens in the left menu. The Tokens’ status field should display OK, as shown in Fig. 6.
![]()
Fig. 6. Checking the status of OAuth 2.0 access tokens in CodeTwo Admin Panel.
Modify MFA service settings for trusted devices
If the Microsoft 365 admin account used to refresh tokens in CodeTwo Admin Panel uses multi-factor authentication, the frequent expiration of access tokens may be related to the MFA service settings in your organization.
Entra ID can remember authentication for a specified number of days before it prompts users to authenticate again. This period also determines how long CodeTwo can use the tokens before they need to be refreshed. Increasing this period can help you avoid recurring token expiration issues.
Follow the steps below to check and modify your MFA service settings:
- Sign in to the Microsoft Entra admin center using a global admin or privileged role admin account.
- Go to Users > All users and select Per-user MFA from the top menu (you may need to click the … button first, as shown in Fig. 7.).
![]()
Fig. 7. Opening the MFA settings in the Microsoft Entra admin center.
- Switch to the Service settings tab and scroll down to the Remember multi-factor authentication on trusted device section (Fig. 8.).
![]()
Fig. 8. Managing MFA service settings for trusted devices.
- Check the number in Number of days users can trust devices for. As mentioned before, this number determines how often you need to refresh your access tokens to let CodeTwo use them.
- If needed, increase this period here or don’t configure it at all – as long as this complies with your organization’s policies. Keep in mind that these settings are applied to all MFA-enabled users and have a direct influence on your organization’s security.
Tip
If the Allow users to remember multifactor authentication on devices they trust checkbox is not selected, the frequent or unexpected expiration of access tokens is probably caused by other factors.
When you select the checkbox for the first time, the default value is 14 days.
- Click Save to save your changes.
| Related products: | CodeTwo Email Signatures for Office 365 |
| Categories: | Troubleshooting |
| Last modified: | November 9, 2026 |
| Created: | October 22, 2018 |
| ID: | 768 |



