Get Highest Score By User / Get Scores By USER occurs appError 1401 -- client is not unauthorized

0 votes
I'm using App42API for cocos2dx.

After getTopNRankersFromFacebook being called and request completion, if I called getHighestScoreByUser or getScoresByUser, no matter how long after the getTopN has been completed, it will return an appError 1401--client is not unauthorize.

I tried to comment getTopNRankersFromFacebook, the getHighestScoreByUser works correctly.

Then I tried to call other methods like saveUserScore after getTopNRankersFromFacebook completion, saveUserScore works well.

Anyone has any idea? Why getHighestScoreByUser gets error after getTopNRankers?
asked Oct 10, 2014 in App42 Cloud API-BaaS by joanna.j (10 points)
recategorized Feb 13, 2015 by sushil
Is your app  ACL enabled? If yes, make sure that Session Id of user is being passed  with the request.
The app ACL is disabled.

1 Answer

0 votes

Hi Joanna,

We tested the above scenario at our end and it is working fine. Can you please share some more details like:

- App42_Cocos2dX_SDK version you are using

- Code snippet you are using to call getHighestScoreByUser

- Also enable SDK internal logs by calling "App42API::setIsTraceEnabled(true);" just after initialising App42API and send us the logs you get.

This information will help us to find the issue quickly.

Thanks.

answered Oct 14, 2014 by rajeev.etc (1,660 points)
- The version of App42 is V_1.7
- the code :
  Before game starting, getTopNfromFB is called
  App42Backend::getInstance()->getTopNRankersFromFacebook(gameName.c_str(), FBManager::getInstance()->getAccessToken(), TOP_N);

   And at the end of the game, getHighestScores is called:
  App42Backend::getInstance()->getHighestScoresByUser(levelNum.c_str(), FBManager::getInstance()->getUserID());

App42Backend::getTopNRankersFromFacebook is defined as following:
void App42Backend::getTopNRankersFromFacebook(const char *gameName, const char *fbAccessToken, int max){
    scoreBoardService->GetTopNRankersFromFacebook(gameName, fbAccessToken, max, app42callback(App42Backend::getTopNRankersFromFacebookRequestCompleted, this));
}

App42Backend::getHighestScoresByUser is defined as following:
void App42Backend::getHighestScoresByUser(const char *gameName, const char *userName){
    scoreBoardService->GetHighestScoreByUser(gameName, userName, app42callback(App42Backend::getHighestScoresByUserRequestCompleted, this));
}

- trace logs:
App42Trace: apiKey=......
App42Trace: fbAccessToken=......
App42Trace: max=3
App42Trace: name=Level_1
App42Trace: timeStamp=2014-10-14T17:37:54.000Z
App42Trace: version=1.0
App42Trace: Headers:
App42Trace: fbAccessToken:......
App42Trace: apiKey:......
App42Trace: fbAccessToken:......
App42Trace: max:3
App42Trace: name:Level_1
App42Trace: timeStamp:2014-10-14T17:37:54.000Z
App42Trace: version:1.0
App42Trace: signature:7BSWzLKLuOKTjhjClzm4xtXcvUc%3D
App42Trace: Accept: application/json
App42Trace: Content-Type: application/json
App42Trace: SDKName: Cocos2d-X
App42Trace: BaseURL=https://api.shephertz.com/cloud/1.0/game/scoreboard/Level_1/rankers/facebook/3?
App42Trace: response code: 200
App42Trace: Response string={"app42":{"response":{"success":true,"games":{"game":{"name":"Level_1","scores":{"score":[{"userName":......

App42Trace: Headers:
App42Trace: fbAccessToken:......
App42Trace: apiKey:......
App42Trace: timeStamp:2014-10-14T17:38:39.000Z
App42Trace: signature:Vse4LdLqQ9ev4reALXlyvFmSu6o%3D
App42Trace: version:1.0
App42Trace: Accept: application/json
App42Trace: Content-Type: application/json
App42Trace: SDKName: Cocos2d-X
App42Trace: BaseURL=https://api.shephertz.com/cloud/1.0/game/scoreboard/Level_1/386472601503715/highest?
Curl curl_easy_getinfo failed: No errorApp42Trace: response code: 401
App42Trace: response failed
App42Trace: error buffer:
App42Trace: Response string={"app42Fault":{"httpErrorCode":401,"appErrorCode":1401,"message":"UnAuthorized Access","details":"Client is not authorized"}}
App42Trace: App42Game failed result is 401
Hi Joanna,
We have solved the issue and updated the SDK to our github repo( https://github.com/shephertz/App42_Cocos2DX_SDK/tree/master/V_1.7.1/App42 ). Please download the SDK V_1.7.1.
Let us know if the problem continues.
Thanks.
Problem solved! Thank you
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
...