apers
Well if the URL is different then that would be why.. You can read my comment below on how to properly migrate/upgrade your data:
After your've migrated and upgraded the data on the new server go to Admin Panel > Settings > System, update the Helpdesk URL to what it actually is, and Save Changes. Then you must go to your App Registration in Entra ID and update the "Redirect URIs" section to add your new URL. Now, you must go back to osTicket and to each email you are configuring OAuth2 for, manually update each Redirect URI to match your new URL (just the base of it - the /api/auth/oauth2 bit stays put), click Save, reauthorize each email, and retest.
Cheers.