I was trying to access jenkins via api
When a api call is made in POSTMAN it is working perfectly fine, but if the same is accessed in an application(written in react), getting the following error
To run : "java -jar jenkins.war"
url : localhost:8080
Some of the thing I tried(which didnt work are) i) Disabling CSRF and ii) Disabling Security(It worked but this is not the solution as it will allow anyone to access it)
"type": "default",
"status": 403,
"ok": false,
"headers": {
"map": {
"content-length": "813",
"x-permission-implied-by": "hudson.model.Hudson.Administer",
"x-you-are-in-group-disabled": "JENKINS-39402: use -Dhudson.security.AccessDeniedException2.REPORT_GROUP_HEADERS=true or use /whoAmI to diagnose",
"content-type": "text/html;charset=utf-8",
"x-content-type-options": "nosniff",
"date": "Sun, 28 Jul 2019 10:21:02 GMT",
"server": "Jetty(9.4.z-SNAPSHOT)",
"x-required-permission": "hudson.model.Hudson.Read",
"x-you-are-authenticated-as": "anonymous",
"x-jenkins-session": "63af948b",
"x-jenkins": "2.176.2",
"x-hudson": "1.395"
}
},
"url": "http://admin:admin@localhost:8080/api/json",
"_bodyInit": {
"_data": {
"size": 813,
"offset": 0,
"blobId": "dc017047-59b3-4dba-8762-38bc4d701714",
"__collector": null
}
},
"_bodyBlob": {
"_data": {
"size": 813,
"offset": 0,
"blobId": "dc017047-59b3-4dba-8762-38bc4d701714",
"__collector": null
}
}
}
I am new to coding and new to jenkins, so i wasn't able to figure it out.
Thanks in advance