unAuthorized access With SendPushToUser

0 votes


I get often this error when I send push notification from my java client desktop application:

13:56:02,687 ERROR App42SendPush:107 - Errore app42:{"app42Fault":{"httpErrorCode":401,"appErrorCode":1401,"message":"UnAuthorized Access","details":"Client is not authorized"}}
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.push.PushNotificationService.sendPushMessageToUser(PushNotificationService.java:674)
This is the code that I use:
    try {
            PushNotificationService pushNotificationService = App42API.buildPushNotificationService();
            PushNotification pushNotification = pushNotificationService.sendPushMessageToUser(userCode, message);
            ret = 1;
        } catch (App42Exception exception) {
            logger.error("Errore app42:" + exception.getMessage(), exception);
            int appErrorCode = exception.getAppErrorCode();
            int httpErrorCode = exception.getHttpErrorCode();
            ret = -1;
What is wrong ? 
Best regards.
asked Oct 27, 2014 in App42 Cloud API-BaaS by odf (37 points)

1 Answer

0 votes

Hello Odf,

Thanks for writing us.

There are different reasons behind getting unauthorized exception and are explained below:

      - 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. If you want to skip the device time check in every call, you can disable the replay attack from AppHQ Management Console. Follow just simple steps:

  • Login to AppHQ Management Console
  • Click on View apps from App Manager 
  • Disable the replay attack for your app

Let us know if it helps.


Himanshu Sharma

answered Oct 28, 2014 by hs00105 (2,005 points)
Hello Odf,

I hope your query has been resolved, kindly let us know if you have more questions for us.

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