I tried to register Workflow Manager with my SharePoint site collection on a new SharePoint 2016 farm. I followed this article and everything was fine until the last step in the process, registering the Workflow Manager in SharePoint using this command:
Register-SPWorkflowService –SPSite http://sharepoint –WorkflowHostUri https://workflow:12291
Unfortunately I struck the following error:
Register-SPWorkflowService : Failed to query the OAuth S2S metadata endpoint at URI ‘http://sharepoint/_layouts/15/metadata/json/1;. Error details: ‘An error occurred while sending the request.’. HTTP headers received from the server….
Quite a few people reported this as being an issue with DNS registrations e.g. the SharePoint site URL not being accessible. I checked DNS name resolution and everything looked fine, so it must something else. If you are having name resolution issues try using a hosts file entry on the SharePoint server to resolve the issue.
The solution was to enable OAuth and Metadata over HTTP. To enable these settings use the following PowerShell on the SharePoint server:
$cfg = Get-SPSecurityTokenServiceConfig
$cfg.AllowOAuthOverHttp = $true
$cfg.AllowMetaDataOverHttp = $true
$cfg.Update()
Now rerun the Register-SPWorkflowService PowerShell command to complete the registration.
I hope this saves you a bit of time!
This didn’t work for me on Windows Server 2016. My issue was that during farm creation, WFM was supposed to grant necessary permissions to the farm and WFM service accounts as well as the Domain Users group but it didn’t. Looks like a bug. I submitted to MS for review. The fix for now is to grant those permissions manually.