Adding an authorization header to the push request

A push request must add an authorization header, which identifies the content provider, to the message. You must create the authorization header with the basic access authentication procedure for messages that are sent by HTTPS. The basic access authentication procedure concatenates a username, a colon, and a password and then encodes the string with the Base64 algorithm.

The Push Service uses the basic access authentication procedure, but it uses specific values for the username and password. The Push Service uses the following values that are provided in the registration email that you receive from BlackBerry when you register to use the Push Service:

username
The Push Service uses the Application ID field in the registration email.
password
The Push Service uses the Pwd field in the registration email.

The authorization header also contains the Content-Type and Content-Length fields.

Content-Type
The type of the message (plain text or xml). This value includes a constant value, boundary=PMasdfglkjhqwert, which is commonly used to indicate the boundaries in a multipart message.
Content-Length
The length of the PAP message content, which must be calculated programmatically.
Authorization
The Base64 value of the credentials, which is in format Username: Password.

Here is a sample authorization header:

{      
    'Content-Type': 'multipart/related; boundary=PMasdfglkjhqwert;type=application/xml',    
    'Content-length': 663,
    Authorization: 'Basic NTE4NS02MzczMzVlRDk3dDcyTzgwODZvOW01dGM3NmU0MzZNM2U0NjpkZURXWDlQVA=='  
}

Last modified: 2015-07-24



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus