Hi All,
I am trying to make a rest call for version creation but I am facing 401, authentication is failing.
2012-02-29 11:03:18,782 http-8090-3 WARN vinutha.vasan 663x29x1 17x9ns8 10.41.190.185 /secure/admin/AddIpVersions.jspa [apache.commons.httpclient.HttpMethodDirector] Unable to respond to any of these challenges: {oauth=OAuth realm="http%3A%2F%2Fjira-dev%3A8090"}
method.getStatusCode:::::::::::401
{"status-code":401,"message":"Client must be authenticated to access this resource.
I am setting JSESSIONID in HttpClient cookie. As shown below,
client.getState().addCookie(
new Cookie(getDomain(), "JSESSIONID", sessionId, "/", null,
false));
Still authentication is failing in standalone jira 4.4. But this was successful @ plugin test environemt using SDK.
Please let me know if I am missing something.
Thanks,
Vinutha
I'm using this code. Hope this helps.
String auth = new String(Base64.encode(userName + ":" + password));
Client client = Client.create();
WebResource webResource = client.resource(url + "/rest/api/2/project");
ClientResponse response = webResource.header("Authorization", "Basic " + auth).type("application/json")
.accept("application/json").get(ClientResponse.class);
int statusCode = response.getResponseStatus().getStatusCode();
if (statusCode == 401) {
throw new AuthenticationException("Invalid Username or Password");
}
String s = response.getEntity(String.class);
log.error("The project rcvd from JIRA are: " + s);
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.