Getting an error while trying to pull the data from ServiceNow into my React App using REST API
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2023 08:53 PM
Hi Team,
I am trying to connect ServiceNow platform to my React app using REST API. However, I am getting error message.
Below is the piece of code for reference:
Note: I have tested the API using "Postman" and it is working fine without any issues(Credentials are correct).
const Fetchincidentdata = useCallback(async () => {
try {
const username = "****";
const password = "******";
const response = await fetch(url, {
mode: "no-cors",
method: "GET",
headers: {
Authorization: "Basic" + btoa(username + ":" + password),
//'Accept': "application/json",
"Content-Type": "application/json",
},
});
const data = await response.json();
Attached the error screenshot for reference:
Please check and help.
Thanks,
Mouli
6 REPLIES 6
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2023 08:10 PM
Did you compare the postman request and the request which you are sending from other app?
Regards,
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2023 06:41 PM
Any help on this please ? My app is completely ready but stuck at this major point.