Error : "Client is not authorized"

+2 votes

I Develop a procedure to upload data in a collection in JAVA.

I make a procedure to insert/update about 100 records in the Storage Service.

I Use storageService and when I make an Upload of data I receive often this message:

com.shephertz.app42.paas.sdk.java.App42SecurityException: {"app42Fault":{"httpErrorCode":401,"appErrorCode":1401,"message":"UnAuthorized Access","details":"Client is not authorized"}}
at com.shephertz.app42.paas.sdk.java.connection.RESTConnectorAsync.handleException(RESTConnectorAsync.java:311)
at com.shephertz.app42.paas.sdk.java.connection.RESTConnectorAsync.executePost(RESTConnectorAsync.java:135)
at com.shephertz.app42.paas.sdk.java.storage.StorageService.insertJSONDocument(StorageService.java:196)
 
I use this syntax:
storageService = App42API.buildStorageService();
storage = storageService.insertJSONDocument(ConfigValues.APP42_DBNAME,ConfigValues.APP42_TEAM_COLLECTION, json);
 
I receive the error always in the same records insert.
 
Can you help me ?
 
Best regards.
 

 

asked Sep 8, 2014 in App42 Cloud API-BaaS by odf (37 points)

I'm a new user (using Unity) and I'm also having this issue whenever I try to run anything in the sample package. Here it is verbatim:

com.shephertz.app42.paas.sdk.csharp.App42SecurityException: {"httpErrorCode":"401", "appErrorCode":"1401", "message":"UnAuthorized Access", "details":"Client is not authorized"}

 

No matter what I do it gives that same error, doesn't seem to matter which module I'm trying to test. I put the app information in Constant.cs as directed but nothing works still, do I need more than the name, id, and secret?

I got this problem to when trying to push json data in storage service, i can't figure how to fix it till now.

1 Answer

+1 vote
 

Hello,

Thanks for writing us.

There are different reasons behind it:

      - Either your API Key & Secret Key is not correct

      - Or the device time is not correct on which app is running,

Please make sure your device time is correct when your are working with device. Also this question is discussed on our FAQ which tell you the reason why it will come.

Let us know if it helps.

Thanks.

Himanshu Sharma

 

answered Sep 9, 2014 by hs00105 (2,005 points)
They api key & secret are correct because I get this error randomly
The routine make this steps:
1) setup api key & secret
2) start a loop to upload data from our db to your storage services.
3) randomly during this loop I get the error "Client is not authorized"

The operation was made from a single Computer with a fixed internet connection so the time is the time of the pc.
I have problem only on InsertJSONDocument and not on UpdateDocument.

Best regards
Hello, It looks like wired that user must have to put his device time proper. Otherwise, he/she will not be able to use the API request. This way this framwork will be useless, because user may change his device time any how he wants. But to use this API, he must have to set it proper. Not satisfy.
Hi Shreyash,

Right time of device is required to authenticate your rest calls. If you want to remove this approach, you can disable replay attach for that application and re-run your sample code . It will resolve your issue, if you still face some issue, then let me know if you require any help from my side.

Regards
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
...