Why doesn't my Custom UI app connect to MS-Graph in some environments?

My Custom UI app connects to the MS-Graph API to read and write calendar events from the user’s Outlook calendar. I have an app set up in Azure, and have set up the Redirect URL. Added everything I need to the manifest file. Configured the secret with forge providers configure.

When I do forge deploy and install my app to Confluence, it shows a ‘Sync with Outlook’ button which I click to synchronise. This, I assume, is where it connects to Azure. If I’ve installed from the default development environment, it all works fine, and I can pull in my events. However, if I install the production version, or if I create a different dev environment and try to install that version, it doesn’t work - I get an error saying that the secret is incorrect.

I don’t understand what would be different about the other environments. As far as I can tell, it sends a client id to the Azure app, but I don’t think I ever configured this in Azure, so I don’t think it would matter if it changed. Would that value be different for a different environment, and would that make any difference?

Any advice is appreciated.