@reviloera wrote:
Hello am trying to send push notification from my nodejs server to ionicframework API and am getting an error here is my code
var token = '66a5c472b52d3210b591f717b5b996312f8xxxxxxxxxxxx';
var title = 'test';
var message = 'message';var options = { method: 'POST', url: 'https://api.ionic.io/push/notifications', headers: { 'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json' }, json : { "send_to_all": true, "profile" : "my-profile", "notification": { "title": title, "message": message, "android": { "title": title, "message": message }, "ios": { "title": title, "message": message } } } }; request(options, function(err, response, body) { if (err) throw new Error(err); console.log(body); });
And am getting this error
{ error:
{ message: 'JWT decode error occurred.',
link: null,
type: 'Unauthorized' },
meta:
{ status: 401,
version: '2.0.0-beta.0',
request_id: '75726406-3060-4329-a59e-3bd7f9ca90c8' } }
Posts: 1
Participants: 1