Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

BlackBerry Push Development

Reply
New Contributor
famendoza
Posts: 2
Registered: ‎01-03-2013
My Device: developer

Receving authentication error upon sending Push Message - Using low level API - Please help!

Hello,

 

I'm getting an unexpected authentication error immediately after I push a message using the Low-Level API. 

 

I've created a Push Initiator using the low-level Push SDK API with no dependancy on Spring.  The sample was based on his link http://supportforums.blackberry.com/t5/BlackBerry-Push-Development/Push-SDK-using-low-level-APIs/m-p...

 

I was able to run the code and confirmed the evaluation credentials (appid, password, PPG URL) match those from the RIM email.  As soon as the PapService.push() returns, the following (edited) error message is returned:

net.rim.pushsdk.commons.UnauthorizedException: Unauthorized to communicate with the PPG at URL: https://cpxxx.pushapi.eval.blackberry.com/mss/PD_pushRequest with username: <appId> and password: <push initiator password>

I got the RIM evaluation credentials about 3 weeks ago - why would the push response be this message?  I can confirm (based on some debugging) that the API is getting back a HTTP 401 error code so I am communicating with the PPG.  I assume the API is correctly sending the appID/password using Basic Authentication.


If anyone can help diagnose this issue it'd be greatly appreciated.  Thank you!

 

Here's an edited version of the code in case it helps diagnose the error:

PapService papService = new PapServiceImpl();
PushSDKPropertiesImpl pushSDKProperties = new PushSDKPropertiesImpl();
papService.setPushSDKProperties(pushSDKProperties);
HttpClientImpl httpClient = new HttpClientImpl();
httpClient.setPushSDKProperties(pushSDKProperties);
papService.setHttpClient(httpClient);

boolean isPublicPush = true;
IdGenerator idGenerator = new IdGeneratorImpl(BLACKBERRY_PUSHID_SEED);
String appId = BLACKBERRY_APPLICATION_ID;

List<String> devicePINs = new ArrayList<String>();
devicePINs.add(devicePIN);
PushMessageControl pushMessageControl = new PushMessageControl(isPublicPush,idGenerator,appId,devicePINs);

StringBuffer finalContent = new StringBuffer();
		finalContent.append(subject)
		.append(Content.NEW_LINE)
		.append(message);
Content pushContent = new TextContent(finalContent.toString());

String username = appId;
String password = BLACKBERRY_PPG_PASSWORD;
String destination = appId;

PushResponse response = null;
try {
  response = papService.push(username, password, destination, pushMessageControl, pushContent);
			
  ResponseResult result = response.getResult();
  StatusCode statusCode = result.getCode();
  String code = statusCode.getCode();
  String description = result.getDescription();
  //PROCESS response
} catch (PushSDKException e) {
	// PRINT error message		
} catch (BadMessageException e) {
	// PRINT error message
} catch (UnauthorizedException e) {
	// PRINT error message
}

 

 

Retired
mdandrea
Posts: 311
Registered: ‎08-08-2012
My Device: BlackBerry Z10

Re: Receving authentication error upon sending Push Message - Using low level API - Please help!

Yep, it's using Basic Authentication.

 

Nothing on the surface looks incorrect with your code, so it seems to be an authentication issue to me.

 

Dumb question probably, but you replaced the xxx with your appropraite content provider ID?

 

Thanks,

 

Matt

New Contributor
famendoza
Posts: 2
Registered: ‎01-03-2013
My Device: developer

Re: Receving authentication error upon sending Push Message - Using low level API - Please help!

[ Edited ]

Hi Matt,

 

you replaced the xxx with your appropraite content provider ID?

Indeed, I replaced it with my CP ID.

 

I'm on the call right now with RIM T-Support 1-(877(personal info removed) given to us by a RIM enterprise account manager and RIM technical service manager would you be able to help assist us directly?  The ticket number is (personal info removed)

Retired
mdandrea
Posts: 311
Registered: ‎08-08-2012
My Device: BlackBerry Z10

Re: Receving authentication error upon sending Push Message - Using low level API - Please help!

If it's not a username/password issue, you can message me directly (my email address should be listed on my profile page I believe) and I can try to help you debug further by looking at the SDK logs, PushSDK.properties file, etc. to see if anything looks out of the ordinary.