• Register
1 vote
106 views

Problem :

I keep on facing the below 403 error while performing the AJAX call to the API.

“403 forbidden: the server understood the request, but is refusing to fulfill it.”

Above error occurs usually in Microsoft Edge, but does not come up in IE, Chrome, Firefox or the Safari.

My page does not use the bootstrap, as I know that it can be caused by a page not been able to locate a .LESS files required. Also I have even tried to include the bootstrap to see if that resolved my issue – but it did not.

I am unable to find anything related by doing research on this. My code is exactly the same across all the various browsers and also the response/request headers match to one another - So is it the case that the POST request is sending the incorrect?

6 5 3
7,540 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

I had the same issue and tried all the solutions which I knew, and neither of them worked actually after long research I found the solution for the error as below:

Please include the credentials in the options as shown in below code snippet.

 

var dummyurl = 'https://dummy_url/_api/lists'
var myoptions = {
    headers: {"Accept": "application/json; odata=verbose"},
    credentials: 'include'
}

fetch(dummyurl, myoptions).then( 
    res => res.json().then(json => console.dir(json)) 
)

 

This works flawlessly for me.

9 7 4
38,600 points

Related questions

0 votes
1 answer 14 views
14 views
Problem: Why is this fix urllib.error.httperror: http error 403: forbidden?
asked Apr 13 jamuna1 30.2k points
0 votes
1 answer 1.2K views
1.2K views
On trying to scrap a website for practice, but I kept on getting the HTTP Error 403 (does it think the user is a bot)? Here is the code: #import requests import urllib.request from bs4 import BeautifulSoup #from urllib import urlopen import re webpage = ... py", line 599, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 403: Forbidden
asked Oct 24, 2020 psandprop 2.4k points
0 votes
1 answer 8 views
8 views
Problem: I'm trying to call a controller method that will save my object, but when i try to url to it, it returns http error. I've browsed through some similar problems on SO but no luck. So i wanna ask myself... Here is my Ajax (for simplicity purposes i renamed the ... function (data) { console.log(json); alert(data.message); resetForm(); }, error: function () { alert("Error!"); } }); }
asked Apr 26 sumaiya simi 43.9k points
0 votes
1 answer 38 views
38 views
Problem: The page at 'https://********someurl****' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint Requesting if anyone can help me get out of this error.
asked Mar 15 ummesalma 29.2k points
0 votes
1 answer 6 views
6 views
Problem: What's the best way to retry an AJAX request on failure using jQuery?
asked Apr 18 ummesalma 29.2k points
0 votes
1 answer 38 views
38 views
Problem: I wrote a script to find spelling mistakes in SO questions' titles. I used it for about a month.This was working fine UPDATE This is the url causing the problem.Even though this url exists. I tried changing the range to some lower values. It works fine now. Why this happened with above url?
asked Feb 21 Mashhoodch 13k points
0 votes
1 answer 10 views
10 views
Problem: I'm trying to call a controller method that will save my object, but when i try to url to it, it returns http error. I've browsed through some similar problems on SO but no luck.
asked May 3 Humaira ahmed 50.7k points
0 votes
0 answers 7 views
7 views
Problem: What is 403 forbidden request forbidden by administrative rules?
asked Mar 30 jamuna1 30.2k points
0 votes
1 answer 6 views
6 views
Problem: I want to have a custom 403 page in my project. So I added these codes in a .htaccess file: Order deny,allow Deny from all Allow from 192.168.1.0/24 ErrorDocument 403 /403.htm But when the project runs from an out of rang IP, and 403 ... request. What is this problem for? I have read different articles inside StackOverflow and other websites, but none of them could not solve this problem.
asked Apr 24 Moumita Bhowmick 12.9k points
0 votes
1 answer 3 views
3 views
Problem: Works perfectly fine in chrome but I had alerts displaying the xmlhttp.status, Someone help.
asked May 3 salim1 60.6k points