Sorry, there was a problem and we can’t open this document. If this happens again, try opening the document in Microsoft Word.”

When you are trying to configure office web apps in SharePoint 2013, you may face the issue like" Sorry, there was a problem and we can’t open this document. If this happens again, try opening the document in Microsoft Word.”
 
In order to resolve the problem, run the following powershell commands.

$config = (Get-SPSecurityTokenServiceConfig) 
 
$config.AllowOAuthOverHttp = $true

$config.Update()