Hi kdkoa, this sounds like an intermittent issue. Assuming the code around your authentication and/or your secrets don't change a lot or not programmed to do so, you will likely need to check with o365 on this.
If this were some other connection related problem, you'd be more likely to run into timeouts or connection refused errors. Our platform environments are quite static so most likely the problem is on the server side. It's at least worth investigating there; perhaps there are other messages in the logs that could help.