What is strange is that it was working fine before, but now I get this error.
Another strange thing: I’m already connected to Gmail and Google Sheets, and they still work. But if I try to reconnect them, I get the same error. So for now I can continue using Gmail and Google Sheets, but if something disconnects me, I won’t be able to reconnect.
I’m running a self-hosted instance of n8n.
So why was it working before, and why is it not working now?
After updating, restart your n8n instance and check the callback URL shown in the credential setup, it should now read https://n8n.yourdomain.com/rest/oauth2-credential/callback. Then make sure that exact URL is listed in your Google Cloud Console under Authorized redirect URIs.