You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to access a JIRA API with httr in R and I am having authentication issues.
I am also using proxy at work, but I found this link (#417) very useful (thank you!), because I could solve the proxy authentication error (407),.. but now I have error 401.
But after that I am getting error 401. I have tried without adding add_headers and set_cookies, but it still gives the same error.
I have tried to modify the use_proxy username and password and gives proxy authentication error (407) when I am using the wrong username and password (401 if they are correct).
But if I modify the username and password in the authenticate section, when I use wrong password and username it still gives error 401 (if the use_proxy section is using the correct username and password). When I use the correct password and username in authenticate also gives error 401.
In the first lines of the verbose output, it says 200 connection established, but in the following lines it appears status 401.
I could access to the JIRA API successfully using Postman (not the latest official Postman release, but a beta version, Postman Canary, which allowed to configure proxy with authentication). To access with Postman I had to first send a POST to url_jira_ini (the authentication site), and after that it generates 2 cookies (atlassian.xsrf.token and JSESSIONID), then I could send a GET to url_jira (the JIRA API that I want to access), which is using basic authentication and the cookie JSESSIONID to access the JIRA API.
In Postman, I have to add the following line in the body (raw):
Would it be possible to add a body in httr, keeping exactly the same line above used in Postman?
I tried to create a body (list) with that line, but it gives error. Any suggestions?
In case it may be useful, to access the JIRA API in Postman Canary (after configuring the proxy for authentication), I followed the next steps:
Delete all cookies previously generated by JIRA.
In the Authorization section, add Authorization "BasicAuth", and include username and password.
In the Body section, select "Raw" and "JSON (application/json)". And in the Body add the following text:
{"username": "myusername" , "password" : "mypassword" }
Send a POST to the JIRA API authentication (url_jira_ini)
Check if it gives 200, and that it gives a JSESSIONID in the cookies (token needed to access the JIRA API).
Send a GET to the JIRA API (url_jira)
What should I do to access the JIRA API with httr?
Should I add additional headers in httr?
Please let me know if you need more information.
I need to solve this issue as soon as possible.
Thank you.
The text was updated successfully, but these errors were encountered:
I am trying to access a JIRA API with httr in R and I am having authentication issues.
I am also using proxy at work, but I found this link (#417) very useful (thank you!), because I could solve the proxy authentication error (407),.. but now I have error 401.
I am using the following code:
library(httr)
library(jsonlite)
url_jira_ini<-"https://jira.host/jira/rest/auth/1/session"
url_jira<-"https://jira.host/jira/rest/api/2/long_name"
credentials<-"username:password"
credentials <- base64_enc(credentials)
header_auth <- paste0("Basic ",credentials)
GET(url_jira,
add_headers(Authorization = header_auth),
set_cookies(
atlassian.xsrf.token
= "long_cookie_1",JSESSIONID
= "long_cookie_2"),authenticate(user = "myusername",password = "mypassword",type="basic"),use_proxy("proxy.host",8080,username="myusername",password="mypassword", auth="basic"),verbose(),accept_json())
But after that I am getting error 401. I have tried without adding add_headers and set_cookies, but it still gives the same error.
I have tried to modify the use_proxy username and password and gives proxy authentication error (407) when I am using the wrong username and password (401 if they are correct).
But if I modify the username and password in the authenticate section, when I use wrong password and username it still gives error 401 (if the use_proxy section is using the correct username and password). When I use the correct password and username in authenticate also gives error 401.
In the first lines of the verbose output, it says 200 connection established, but in the following lines it appears status 401.
I could access to the JIRA API successfully using Postman (not the latest official Postman release, but a beta version, Postman Canary, which allowed to configure proxy with authentication). To access with Postman I had to first send a POST to url_jira_ini (the authentication site), and after that it generates 2 cookies (atlassian.xsrf.token and JSESSIONID), then I could send a GET to url_jira (the JIRA API that I want to access), which is using basic authentication and the cookie JSESSIONID to access the JIRA API.
In Postman, I have to add the following line in the body (raw):
{"username": "myusername" , "password" : "mypassword" }
Would it be possible to add a body in httr, keeping exactly the same line above used in Postman?
I tried to create a body (list) with that line, but it gives error. Any suggestions?
In case it may be useful, to access the JIRA API in Postman Canary (after configuring the proxy for authentication), I followed the next steps:
{"username": "myusername" , "password" : "mypassword" }
What should I do to access the JIRA API with httr?
Should I add additional headers in httr?
Please let me know if you need more information.
I need to solve this issue as soon as possible.
Thank you.
The text was updated successfully, but these errors were encountered: