Sending Ionic Push notification through API gets error


#1

Hi guys!

We are working with Ionic Push and it’s a feature that we absolutely love, but we are encountering some issues and little or no info about them.

Our app is configured properly, so it is capable of receive Ionic Push notifications sent by Ionic Push Dashboard. The problem comes when we try to send notifications to the service’s API. We are getting the same error message again and again: “Unable to authenticate”.

We are following line by line the DOCS, sending the correct PRIVATE API KEY and APP ID, even trying not only using cURL + PHP but AngularJS as well.

Thanks in advace,

Antonio


#2

The same error here.Don’t know how to resolve this


#3

I get the same error, followed the guide step by step, images from google don’t match though. Only using the curl demo and it fails.


#4

hi, i have an example how i use the api and its working. remember to encode your api secret key

example

just an example

api-key="123456789123456789"
ecodeapikey="MTIzNDU2Nzg5MTIzNDU2Nzg5"
you have to use your encodeApiKey in your header

POST /api/v1/push HTTP/1.1
Host: push.ionic.io
Authorization: Basic MTIzNDU2Nzg5MTIzNDU2Nzg5
X-Ionic-Application-Id: 6d5a8318
Content-Type: application/json
Cache-Control: no-cache

{ “tokens”:[ “APA91bHeSALts9tTeTA9v0po-VNYLIlo8CQDhvDuIzLkc36E7VX5FcnOg8AF8w1WuJF2wLQ9BqBviluDA_pd69kP0MPPLEQrSrXwBCl5fIyNzbkLJRgQCkKgitxVfojiMkHFLvhuC_MA” ], “notification”:{ “alert”:“test alert”, “android”:{ “collapseKey”:“foo”, “delayWhileIdle”:true, “timeToLive”:600, “payload”:{“message”: “matricula disponible”,“title”:“ABC”,“key1”:“value”, “key2”:“value”, “$state”:“tab.chat-detail” , “$stateParams”: “{“placa”: 19}”} } } }


#5

Thanks, @correasebastian!

Finally it’s working like a charm.

Regards


#6

I have the same problem, I can send push notifications from the dashboard but when I try to send notifications through the API, I recive this error and I don’t know what to do, I don’t know if I am encoding the api key well or not… :S


#7

how to use this code in json