안녕하세요.
게시판에서 새 글이 올라오면 앱으로 푸쉬를 주는 걸 만들려고하는 초보자입니다.
파이어베이스에서 notification으로 메세지를 날리면 알람이 뜨는 것 까지는 했습니다.
그런데 아래의 소스 예제를 실행하는데 NotAuthorizedError가 떠서 막힌 상태입니다.
var FCM = require('fcm-push');
var serverKey = '';
var fcm = new FCM(serverKey);
var message = {
to: 'registration_token_or_topics', // required fill with device token or topics
collapse_key: 'your_collapse_key',
data: {
your_custom_data_key: 'your_custom_data_value'
},
notification: {
title: 'Title of your push notification',
body: 'Body of your push notification'
}
};
//callback style
fcm.send(message, function(err, response){
if (err) {
console.log("Something has gone wrong!");
} else {
console.log("Successfully sent with response: ", response);
}
});
serverKey와 registration_token에는 아래 그림의 빨간 부분의 값을 넣어서 수행했습니다.

잘못된 값을 넣은건지 아니면 아직 환경 구축이 덜 된건지 알 수 있을까요?
node는 위 소스 파일만 작성해서 실행하였습니다.