Ionic push - Unable to Authenticate

Hi team,

I have a problem with api rest on my server for send my notification. The response is : {“result”:“error”,“message”:“Unable to Authenticate”}.

My code :

$msg = array
		'alert' 	=> 'Test Notif'
	$fields = array
		'tokens' 		=> $tokens,
		'notification'	=> $msg
	$headers = array
		'Authorization: Basic MySecretApiKey',
		'Content-Type: application/json',
		'X-Ionic-Application-Id: MyIdApp'

	$ch = curl_init();
	curl_setopt($ch,CURLOPT_URL, '' );
	curl_setopt($ch,CURLOPT_POST, true);
	curl_setopt($ch,CURLOPT_HTTPHEADER, $headers);
	curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch,CURLOPT_POSTFIELDS, json_encode($fields) );
	$result = curl_exec($ch);

Where is the problem ?
Thx a lot

We are also facing the same issue. Both for dev and GCM push.Can someone from the ionic team please respond if the ionic push works?

same issue here did you find a solution ?

Yes, you are probably using PUB KEY instead of PRIV KEY.

Any other thoughts on this? I’m using a Secret Key that is registered to handle both development and prod notifications, and using the One-Time Notification page on the Ionic Console works, but when trying to send a request via the Rest API it fails with ‘Unable to Authenticate’.

You need to base64 encode your api key

Thanks so much. Worked.

It worked for me but then it’s asking for a password. Which password to enter??