Click here to Skip to main content
15,890,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a post method

function GetTokenfromGrap(resource, obj, failureCallback) {
    debugger;
    var deffered = $q.defer();
    var url = baseUrl +resource;
    var configurations = {
            headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
    }
}

    $http.post(resource, obj, configurations).then(deffered.resolve).catch(function (data) {
        handleCatch(data);
        if (typeof failureCallback === 'function') failureCallback(data);
});
    return deffered.promise;
}


when i run this iget error like

Quote:
:4200/welcome:1 Failed to load https://login.microsoft.com/xxxxx.com/oauth2/token: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access.


What I have tried:

i googled it but didnt get correct solution
Posted
Comments
Richard Deeming 26-Jun-18 9:35am    
The error is quite clear: Javascript running on your website is not allowed to request content from the login.microsoft.com site.

Either you're using the wrong URL, or what you're trying to do is not supported.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900