• Resolved saintxiao

    (@saintxiao)


    0
    down vote
    favorite

    i call https from app.js on ionic framework, but unable to get the data, on console there show “reason: missing token ‘authorization’ in CORS header ‘Access-control-allow-headers from cors preflight channel'”

    i test on firefox restclient everything working ok.

    also i am test curl on mac terminal also can get the data back.

    curl --user wes:1231231 http://192.168.1.1/wordpress/wp-json/users/

    but the following code on ionic framework it’s showing error on console

    cross-origin request blocked: this same origin policy disallows reading the remote resource at http://192.168.1.1/wordpress/users.(reason: missing token ‘authorization’ in CORS header ‘Access-control-allow-headers from cors preflight channel’

    var string = $base64.encode('wes' + ':' + '1231231');
    $http({
       method: 'GET',
       url 'http://192.168.1.1/wordpress/wp-json/users/',
       headers:{'Authorization': 'Basic '+ string }
    })
    .success(function(data, status){
       console.log(data);
    });

    https://ww.wp.xz.cn/plugins/json-rest-api/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘missing token authorization in cors header’ is closed to new replies.