How to request an OAuth consumer key from jfs:oauthRequestConsumerKeyUrl?
Hello,
I started developing a custom OSLC adapter in order to connect my applicattion to DNG (6.0.3) as a friend, and therefore trying to understand the logic behind Jazz-specific OAuth properties, in particular jfs:oauthRequestConsumerKeyUrl. Currently i'm investigating this from a REST client. According to "Additional OAuth-related Properties in Root Services Documents" specification (https://jazz.net/wiki/bin/view/Main/RootServicesSpecAddendum2) it should be possible to make an HTTP POST to jfs:oauthRequestConsumerKeyUrl <./oauth-request-consumer> from the rootservices document with:
{ "name": "consumer name", <--- The desired name of the consumer "secretType": "string", "secret": "secret", <--- The desired consumer secret "trusted": "false", <--- The desired trust setting "userId": "userId-name" <--- The desired user to be associated with the consumer }as a request body. However, it doesn't work, as the request returns 403 response with an error message:
Perrmision denied.
Your account does not have the group memberships required to access the requested resource.
What is the correct HTTP call to be made in order for this to work as described in the specification? Or is there something else missing?
3 answers
The error message says that you need an appropriate repository role (very likely JazzAdmins) to complete the request. Have you verified that you have logged in and got the right role?
I was able to get the following POST to work without the X-Jazz-CSRF-Prevent header:
The server responded:Request a Provisional ConsumerKey for Patricia, the JazzAdmin
curl -X "POST" "https://some.jazz.com:9443/jts/oauth-request-consumer" -H "Content-Type: application/json; charset=utf-8" -d $'{"secret": "PatriciaConsumerSecret", "secretType": "string", "trusted": "false", "name": "PatriciaConsumerName", "userId": "patricia"}'
HTTP/1.1 200 OK X-Powered-By: Servlet/3.0 x-com-ibm-team-scenario: 216.188.237.248 Content-Type: text/json;charset=UTF-8 Content-Language: en-US Transfer-Encoding: chunked Connection: Close Date: Mon, 22 May 2017 11:55:27 GMT {"key":"scrambledeggs"}