Register-SPWorkflowService : Failed to query the OAuth S2S metadata endpoint at URI ‘what the @#@$@##?’ is going on

If you have followed the instructions on this site to create the workflow management service and you can see the service in IIS, you see the site in IIS, but when you go to register the workflow service you’re getting this lovely error:

Register-SPWorkflowService : Failed to query the OAuth S2S metadata endpoint at URI

followed by some URI endpoint that lists the name of the server where you installed the workflow management service then you need to run the following lines of powershell to resolve

 

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

As you can see here in the image, we created a site named portal.racktest.local that we were going to register the workflow service endpoint to for the farm.  This is not the best way, as this site might get deleted.  The best approach is to register the workflow management service to the central admin site.  Central admin should not change and should not get deleted.

After running the 4 lines of powershell that allow the OAuth over http to happen, then we are able to register the workflow service with the farm.