Failed to query the OAuth S2S metadata endpoint

Upon registration of workflow service in SharePoint 2013, running the following command in SP Management Shell:
[powershell]Register-SPWorkflowService -SPSite http://testsite/sites/workflow1 -WorkflowHostUri https://testsite:12290[/powershell]
the following error is displayed:

Register-SPWorkflowService : Failed to query the OAuth S2S metadata endpoint at URI http://testsite/sites/workflow1/_layouts/15/metadata/json/1 .

Error details: 'The metadata endpoint responded with an error. HTTP status code: Forbidden.

It seems that the permissions are missing (403). However, if you open the indicated JSON URL with IE logged in as admin, you get the expected result.

In order to resolve this issue:
1. go to Central Administration
2. Manage Service Applications
3. Select the Workflow Service Application
4. In the ribbon bar, click on „Administators”, add tha Farm Admin and grant him full control.

Re-run the shell command, it should now run smoothly without error.

Hope this helps,