Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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?

0 votes



3 answers

Permanent link

I was able to get the following POST to work without the X-Jazz-CSRF-Prevent header:

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"}'

The server responded:
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"}

0 votes

Comments

 Jazz.net's HTML editor is ... not the best.


Permanent link

It started working after several browser session restarts and adding "X-Jazz-CSRF-Prevent" headers with JSESSIONID as a value.

0 votes


Permanent link

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?

0 votes

Comments

Yes, I'm logged in with a user that has the following roles: JazzAdmins, JazzUsers, JazzProjectAdmins.

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,926
× 515
× 35

Question asked: Mar 08 '17, 8:54 a.m.

Question was seen: 3,739 times

Last updated: May 22 '17, 8:08 a.m.

Confirmation Cancel Confirm