I am attaching an email text from Automattic Support or state they tracked the issue down to wordfence in my Woocommerce logs.
——————————
I am so sorry to hear about your issues with the Square connection. I also saw you reported the same issue about a month back.
Thank you for sharing the log file, I was able to see that the Square connection is getting disconnected due to invalid authorization. I suspect this might be due to the Wordfence plugin.
From the System Status Report you shared earlier, I see you have Wordfence installed. If that's changing WP salts, the Square plugin won't be able to connect to the Square servers. (For your information, 'WP salts' basically are related to security and authorization in WordPress.)
You could try keeping the Wordfence plugin deactivated for the next 30 days and see if the issue disappears. If it does, I recommend you to reach out to Wordfence support and ask them how to disable the plugin from changing the WP salts.
————
A separate email
It does appear that the connection is able to refresh, and at other times, it gets cancelled. As previously mentioned, we have been able to see this behavior when security plugins are at play on a WordPress site. You could try keeping the Wordfence plugin deactivated for the next 30 days and see if the issue disappears. If it does, I recommend you to reach out to Wordfence support and ask them how to disable the plugin from changing the WP salts.
Please let us know if this removes the issue for you after observing for the next 30 days.
Please let us know so we can help you out further, thanks!
Sincerely,
Orhan
Happiness Engineer | Automattic