Use the jQuery to Backend Management API and get 403 Access deined .



  • HI~

    I’d like to use Jquery to post data to the Backend Management API , but always get 403 access deined .

    here is my code

    
    function push(){
    
        var postdata = {
            "jsonrpc": "2.0",
            "method": "User.list",
            "params": {
                "page": 1,
                "itemsInPage": 10,
                "sortProperty": "Oid",
                "sortOrder": "desc",
            },
            "id": 1
        }    
           
           
        $.ajax({    
           url: "https://cloud.monaca.mobi/manage/json-rpc/<Backend Api Key>",
           headers: { 
            "X-Monaca-Backend-Management-API-Key":"<Backend Api Key>",
           },
           dataType : "json",
           data: JSON.stringify(postdata),
           type: "POST",
           error: function() { alert("error") },
           beforeSend:function(){},
           success: function(json){
                console.log(json);     
           }
        }); 
        
    }
    
    

    it always show the

    {"jsonrpc":"2.0","id":1,"error":{"code":1,"message":"Authentication failed: 403 Access denied"}}
    

    What am I missing?

    Thanks !



  • @MarkChu, your "X-Monaca-Backend-Management-API-Key is most likely incorrect. Double check.


  • Monaca

    @MarkChu
    It seems like your Push notification setting is not completed or incorrect.
    Have you successfully enable the push notification on Monaca Backend?
    Please refer to the following documentation:



  • thank you all ,
    I find the problem , and is works now ~~


Log in to reply