Error Code #1401

0 votes

Hello 

 

In executing the following code using the Javascript SDK 

 

features.scoreBoard.getScoresByUser('xxxxx','xxxxxx',{
success : function(r) {
binder.scope.user.scores = JSON.parse(r).app42.response.games.game.scores.score;
var ids = binder.scope.user.scores.pluck('scoreId');
features.gameData.findDocumentsByQuery('uxxxx,'xxxxxx',(new QueryBuilder()).build("scoreId", ids , Operator.INLIST),{
success:function(r){
var data = JSON.parse(r).app42.response.storage.jsonDoc;
console.log(r);
},
error:function(r){
 
}
});
},
error : function() {
}
});
I get the subject message code with the following details when I try to findDocumentsByQuery()
 
{"app42Fault":{"httpErrorCode":401,"appErrorCode":1401,"message":"UnAuthorized Access","details":"Client is not authorized"}}
Please advise as to what is causing this.
asked Nov 17, 2014 in App42 Cloud API-BaaS by Kenny Arneaud (15 points)
edited Nov 17, 2014 by Kenny Arneaud

1 Answer

0 votes
Hello Kenny,
 
The error which you have shared is occur when client is fail to create the exact singnature. We are working on this issue , also we will provide functionality to find the additional info of user related to the score id for which you don't need to make one extra call & it will be live in month end release. 
 
Thanks for your patinece & co-opertaion with us.
 
Thanks,
 
Himanshu Sharma
answered Nov 18, 2014 by hs00105 (2,005 points)
Is there any sort of work around till then? This kind of halts progress!
Is there some sort of ETA I can expect as to when this issue would be resolved?
Hello Kenny,

Apologies for the delay in response.

Kindly find the below code snippet to fetch the relative JSON document stored in storage service along with leader-board call:

var gameName = "<Enter_your_game_name>",
userName = "Nick",
result ;  
var otherMetaHeaders = { isAttachScoreId : true };
scoreBoardService.setOtherMetaHeaders(otherMetaHeaders);                 
scoreBoardService.getScoresByUser(gameName,userName,{  
            success: function(object)
            {
                        var game = JSON.parse(object);  
                        result = game.app42.response.games.game;
                        console.log("gameName is : " + result.name)
                        var scoreList = result.scores.score;
                        console.log("userName is : " + scoreList.userName)
                        console.log("scoreId is : " + scoreList.scoreId)
                        console.log("value is : " + scoreList.value)
            },  
            error: function(error) {  
            }  
});
 
Let us know if it helps.
Himanshu Sharma
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...