Problem authorizing requests in JIRA OSLC Adapter through OAuth
The remote server returned an error: (401) Unauthorized.
Header: Server: Apache-Coyote/1.1
WWW-Authenticate: OAuth realm="http%3A%2F%2Flocalhost%3A8080",OAuth realm="http%3A%2F%2Flocalhost%3A8080", oauth_problem="token_rejected"
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
The OAuth token has been successfully authenticated before though - could the problem lie in the OAuth realm?
2 answers
Comments
Hi, I have developed the client myself, it is written in C# and bases on the OAuthBase library. The authentication steps are performed as follows:
1. Obtaining the request token at http://10.1.2.50:8080/rest/oslc/latest/oauth/request_token - runs OK, returns a token and a token secret.
2. Authorizing the request token at http://10.1.2.50:8080/rest/oslc/latest/oauth/authorize using the browser - after entering the credentials a page appears with "You have successfully authorized oauth_consumer_name"
3. Exchange of request token for the access token at http://10.1.2.50:8080/rest/oslc/latest/oauth/access_token - also runs without a problem, returns the access token and a token secret that is the same as for the request token
4. Using the access token to access resources, eg. at http://localhost:8080/rest/oslc/latest/changerequests/SANDBOX-1 is the problematic part where the error message "token rejected" is returned. I am using POST to send the OAuth parameters to the server.
An example of the request that accesses protected resources:
POST http://localhost:8080/rest/oslc/latest/changerequests/SANDBOX-1 oauth_consumer_key=70f8de64a18400d2712956db97bd7277&oauth_nonce=6376433&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1349255669&oauth_token=331554bdbad10ec1621596421d880f67&oauth_version=1.0&oauth_signature=LfKJ68lFkf7Aw7w0vJVPSnDXTkk=
Just a remark: The "10.1.2.50" and "localhost" refer to the same computer in this case, I have made sure the difference here does not cause the above described issue. Sorry for the confusion.