This summer it’s being a troubleshooting summer 🙂
This problem happened to us in our O365 environment, when we tried to Access to O365 outside of our network it shows an error message from the ADFS server, but when we tried to access to O365 inside our network all works well, so the problem begins weird.
At the beggining I was thinking in a problem in the ADFS Proxy, but suddenly I remember a recent post about renewing certificates:
So the first thing was to check the certificates in the ADFS, and bang! Were out of date, so I decided to renew them manually and (most important), restart the AD FS Windows Service on the primary AD FS server.
After doing that the problem was solved and it was possible to Access to O365 inside and outside of our network.