0

i'm trying to do a login service to my app but something went wrong. Here is my $http:

$http({
        method:"get",
        url: ## BLAH BLAH BLAH,
        headers: {
            'Authorization': 'Basic ' + $base64.encode(loginData.usuario + ':' + loginData.senha)
        }
    }).then(function success(response){
        ## BLAH BLAH BLAH
    }, function error(response){
        ## BLAH BLAH BLAH
    });

When i run that $http it show a error on console:

XMLHttpRequest cannot load ## BLAH BLAH BLAH. 
Request header field Authorization is not allowed by Access-Control-Allow-Headers in preflight response.

What i'm doing wrong? Sincerely, Lucas.

Lucas Müller
  • 382
  • 1
  • 4
  • 21

1 Answers1

0

checkout the same origin policy, notice that www.balabala/api is not same with balabala/api

My guess is you call from balabal to www.balabala/api or from www.balabala to balaba/api, set url to /api.

Jerry Chen
  • 715
  • 7
  • 21