2

I'm attempting to make a Web 2.0 API call via AngularJS using $http.post that returns JSON and as weird as this may sound, it worked an hour ago, now it doesn't and I haven't changed a thing. The application continues to work in all other browsers, it just fails in Edge.

var _login = function (loginData) {
        var data = "";
        var grant = [insert data to authorise user on server];
        var deferred = $q.defer();
        $http.post(serviceBase + 'token', data, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).success(function (response) {
            _userlogin(response);
            deferred.resolve(response);
        }).error(function (err, status) {
            console.log(err + " " + status);
            _logOut();
            deferred.reject(err);
        });
        return deferred.promise;
    };

I've had to take some info out there because it's security info, but the functionality should be the same, so, from debugging I know that this is where the application stumbles. I also know that the logindata passed in is valid and I've tried the same call with the same grant on a REST client and that works fine also like I mentioned before the same call with no alterations runs in any other major browser (including IE weirdly).

When that call is run, the front end angular does the following:

$scope.authUser = function (username, password) {
            var loginData = { userName: username, password: password, useRefreshTokens: login.useRefreshTokens}
            authService.login(loginData).then(function (response) {
                console.log(response);
                sessionStorage.setItem("status", "User Logged In As: ");
                sessionStorage.setItem("username", username);
                global.template = "templates/dashboard.html";
                login.password = "";
            },
            function (err) {
                console.log(err);
                login.message = err.error_description;
                $("#passwordError").modal();
            });
        };

The application stops at login.message = err.error_description;, because it's not returned from the API call. The error is: Network Error 0x2efd, Could not complete the operation due to error 00002efd. and Unable to get property 'error_description' of undefined or null reference.

Edit: Forgot to mention - the application works when Fiddler is open and capturing traffic. That's the strangest part.

15
  • Remove all the console.log from your code. Sometimes, it solves IE issues. Commented Aug 2, 2017 at 14:13
  • Nope still broken - two errors are: Unable to get property 'error_description' of undefined or null reference and Network Error 0x2efd, Could not complete the operation due to error 00002efd. Commented Aug 2, 2017 at 14:15
  • I am not sure but possibly problem connected with your headers. Just change them to application/json and check (to be sure that problem still here) In my apps http works fine for now. Commented Aug 2, 2017 at 14:20
  • 1
    Take a look at this post which used the solution mentioned here. They're saying the issue was with interacting between localhost to localhost. Hope that helps. Commented Aug 2, 2017 at 14:41
  • 1
    @Mickers - Thank you! That was the problem - at least now I know that I can test Edge when the application is published - If you throw that in as the answer I'll mark it off if you like for future reference Commented Aug 3, 2017 at 12:47

1 Answer 1

1

Take a look at this post which used the solution mentioned here. They're saying the issue was with interacting between localhost to localhost.

I'm glad I was able to help.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.