Title: Authorization Issue
Last modified: January 19, 2022

---

# Authorization Issue

 *  Resolved [cgoro](https://wordpress.org/support/users/cgoro/)
 * (@cgoro)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/authorization-issue-2/)
 * Am currently running Version 1.8.5 of the mail integration plugin on our site.
   
   After the update, the plugin stopped working and prompted for reauthorization.
   When attempting the reauthorization the below error keeps occurring: `Fatal error:
   Uncaught _PhpScoper99e9e79e8301\Firebase\JWT\ExpiredException: Expired token 
   in /home/gertiesweb/public_html/wp-content/plugins/mail-integration-365/libs/
   vendor/firebase/php-jwt/src/JWT.php:124 Stack trace: #0 /home/gertiesweb/public_html/
   wp-content/plugins/mail-integration-365/libs/vendor/thenetworg/oauth2-azure/src/
   Token/AccessToken.php(24): _PhpScoper99e9e79e8301\Firebase\JWT\JWT::decode('eyJ0eXAiOiJKV1Q...','-----
   BEGIN PUBL...', Array) #1 /home/gertiesweb/public_html/wp-content/plugins/mail-
   integration-365/libs/vendor/thenetworg/oauth2-azure/src/Provider/Azure.php(334):
   _PhpScoper99e9e79e8301\TheNetworg\OAuth2\Client\Token\AccessToken->__construct(
   Array, Object(_PhpScoper99e9e79e8301\TheNetworg\OAuth2\Client\Provider\Azure))#
   2 /home/gertiesweb/public_html/wp-content/plugins/mail-integration-365/libs/vendor/
   league/oauth2-client/src/Provider/AbstractProvider.php(462): _PhpScoper99e9e79e8301\
   TheNetworg\OAuth2\Client\Provider\Azure->createAccessToken(Array, Object(_PhpScoper99e9e79e8301\
   League\OAuth2\Client in /home/gertiesweb/public_html/wp-content/plugins/mail-
   integration-365/libs/vendor/firebase/php-jwt/src/JWT.php on line 124` The last
   time this error occurred [@edwardcross](https://wordpress.org/support/users/edwardcross/),
   recommended reauthorization which worked then but is not working today.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fauthorization-issue-2%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Thread Starter [cgoro](https://wordpress.org/support/users/cgoro/)
 * (@cgoro)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/authorization-issue-2/#post-15268552)
 * The error displayed on the plugin page:
    invalid_grant AADSTS54005: OAuth2 Authorization
   code was already redeemed, please retry with a new valid code or use an existing
   refresh token. Trace ID: 1bbf59c6-5e03-4829-8575-5fb577997700 Correlation ID:
   a8f59c80-054d-4bc9-ac40-9bb5e670cbf7 Timestamp: 2022-01-19 13:38:10Z
 *  [edwardcross](https://wordpress.org/support/users/edwardcross/)
 * (@edwardcross)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/authorization-issue-2/#post-15269290)
 * [@cgoro](https://wordpress.org/support/users/cgoro/) so you are loading the settings
   page with the old authorisation code still within the URL. Clear the settings
   page URL of any URL parameters (that’s everything after the ?) and reload the
   page. Once it’s loaded, try the authorise button again.
 *  [edwardcross](https://wordpress.org/support/users/edwardcross/)
 * (@edwardcross)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/authorization-issue-2/#post-15269298)
 * [@cgoro](https://wordpress.org/support/users/cgoro/) the other thing you could
   check (having read this guide: [https://docs.microsoft.com/en-us/answers/questions/311300/oauth2-authorization-code-was-already-redeemed.html](https://docs.microsoft.com/en-us/answers/questions/311300/oauth2-authorization-code-was-already-redeemed.html))
   is that your client secret hasn’t expired.
 * The expiry time is set when you create the secret. If you chose just a few months
   this might explain the error. If it’s expired, you will need to create a new 
   secret and copy this into the plugins settings area.
 *  Thread Starter [cgoro](https://wordpress.org/support/users/cgoro/)
 * (@cgoro)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/authorization-issue-2/#post-15269448)
 * The secret value has not expired.
    I have cleared the settings URL of any parameters
   but the Fatal Error is still recurring when I attempt authorization. The second
   error about the invalid grant is no more.
 *  [edwardcross](https://wordpress.org/support/users/edwardcross/)
 * (@edwardcross)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/authorization-issue-2/#post-15279197)
 * [@cgoro](https://wordpress.org/support/users/cgoro/) so I would make a note of
   the Client and Tenant ID’s then untick the option “Keep OAuth Credentials” in
   the plugin settings page (if it isn’t already unticked). I’d then deactivate 
   and reactivate the plugin.
 * Re-enter the client and tenant ID’s and regenerate a client secret from within
   the Azure App settings on the Azure AD Portal (id delete the old secret as well).
 * Save the settings and then reauthorize. This process should clear all the old
   values from the database.
 *  [edwardcross](https://wordpress.org/support/users/edwardcross/)
 * (@edwardcross)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/authorization-issue-2/#post-15500272)
 * [@cgoro](https://wordpress.org/support/users/cgoro/) I assume, as it’s been over
   two months that this was fixed so I’m closing.
 *  Thread Starter [cgoro](https://wordpress.org/support/users/cgoro/)
 * (@cgoro)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/authorization-issue-2/#post-15500800)
 * The issue was resolved

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Authorization Issue’ is closed to new replies.

 * ![](https://ps.w.org/mail-integration-365/assets/icon-256x256.png?rev=2817704)
 * [WPO365 | Mail Integration for Office 365 / Outlook](https://wordpress.org/plugins/mail-integration-365/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mail-integration-365/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mail-integration-365/)
 * [Active Topics](https://wordpress.org/support/plugin/mail-integration-365/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mail-integration-365/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mail-integration-365/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [cgoro](https://wordpress.org/support/users/cgoro/)
 * Last activity: [4 years, 2 months ago](https://wordpress.org/support/topic/authorization-issue-2/#post-15500800)
 * Status: resolved