In this post, we will fix the “Failed to query the OAuth S2S metadata endpoint at URI” SharePoint Workflow Manager issue that you may face when you register SharePoint Workflow Service in SharePoint 2016 and 2019.
Register-SPWorkflowService: Failed to query the OAuth S2S metadata endpoint at URI.
Failed to query the OAuth S2S metadata endpoint at URI
I have configured Workflow Manager for SharePoint 2016, and when I tried to Register the SharePoint Workflow Manager service using PowerShell. I got the below error message:
Failed to query the OAuth S2S metadata endpoint at URI “http://site/_layouts/15/metadata/json/1 Error details: ‘An error occurred while sending the request.’. HTTP headers received from the server – ActivityId
Actually, the “Workflow Failed to query the OAuth S2S metadata endpoint at URI” issue usually occurs in case of,
- The “Register-SPWorkflowService” cmdlet is missing some important parameters.
- The SharePoint Management Shell is not running as Administrator.
- Firstly, you should be aware of the SharePoint with a non-SSL certificate requires the “–AllowOAuthHttp” parameter.
- Secondly, you should provide the correct value for “-SPSite” and “WorkflowHostUri” correctly.
SPSite: Specifies a site collection to configure.
It seems that each site collection needs to be registered with workflow service. therefore, it’s not 100% correct, once you have registered a workflow service to any SharePoint site collection within the farm, it will be enabled for all SharePoint web applications/site collections. I am pretty sure about this behavior and that what I got on my farm.
WorkflowHostUri: Specifies a string of the full URI for the Workflow Service.
The provided ports must be the same provided ports in the Configure Ports step as above mentioned.
by default, it’s 12291 for HTTP and 12290 for HTTPS.
- Now, log in to the SharePoint server that you have installed your workflow manager on it. ( This account should be a member of the Workflow Admin Group.)
- Then, open the SharePoint Management Shell as Administrator.
- At the end, try to run the “Register-SPWorkflowService” cmdlet with your own parameters which should be like the below:
Register-SPWorkflowService -SPSite 'http://sitecollectionurl' -WorkflowHostUri 'http://site:12291' -AllowOAuthHttp -force
After registering the SharePoint Workflow Service properly, you should follow the SharePoint Workflow Manager Health Checklist to make sure that the Workflow Manager has been configured correctly.
If the above steps don’t help, and you still face the “Failed to query the OAuth S2S metadata endpoint” issue, therefore you should try to run the below cmdlets before registering the workflow service to update Allow OAuth Over Http and its metadata in the SPSecurityTokenServiceConfig.
$config = (Get-SPSecurityTokenServiceConfig) $config.AllowOAuthOverHttp = $true $config.AllowMetaDataOverHttp = $true $config.Update()
Finally, if you still can’t register the workflow manager service, you should delete the Workflow Manager Service Proxy, then register the workflow manager service as mentioned at Re-register SharePoint Workflow Manager Service.
Register Register-SPWorkflowService Known Issues
Below are also known Issues that you may face when you run Register-SPWorkflowService.
- The HTTP request has timed out after 200000 milliseconds.
- The Caller doesn’t have the necessary permissions required for this operation.
- Register-SPworkflowservice unable to connect to the remote service at Workflow Manager 2016.
In this post, we have tried to solve “Register-SPWorkflowService: Failed to query the OAuth S2S metadata endpoint at URI.” that we had faced when you registered the SharePoint Workflow service.
- SharePoint 2019.
- SharePoint 2016.
- Workflow Manager.
You might also like to read
Have a Question?
If you have any related questions, please don’t hesitate to ask it at deBUG.to Community.