0

I'm using https://github.com/davibennun/laravel-push-notification package for push notification in laravel. I have created api-key from console.developers.google.com/apis(credentials/new project/create-credentials). I am using my mobile device id as Android device token. But when I try to send push notification I get 401 error as displayed in the below image. Can somebody help on this? enter image description here

Abhilash
  • 39
  • 1
  • 10
  • How are you sending the message? By *mobile device id*, do you mean the actual registration token? – AL. Jul 16 '17 at 01:40
  • @AL. I'm not using actual token. I'm using my Android mobile's id, which I get from settings->About Phone->Status->IMEI information number->IMEI(slot1). I am creating push notification API for mobile device.So I am not getting how to take device token and api-key. Can you help on this? – Abhilash Jul 17 '17 at 05:09
  • That's not how GCM/FCM works. You'll have to use the generated Registration token as the target in order to push notifications to that specific device. – AL. Jul 17 '17 at 05:36
  • @AL. Thanks for replying. I was reading your posts regarding fcm. I'm using laravel for back-end coding. So to get api-key of fcm, I should create a project(example. TestPush) and get api-key from that project to my laravel coding? – Abhilash Jul 17 '17 at 05:44
  • Hi Abhilash. Yup. You'd need the Server Key in order to send messages. Then, to be able to target a specific device, you'd need the [registration token](https://stackoverflow.com/q/37671380/4625829) – AL. Jul 17 '17 at 05:57
  • @AL. Thanks for the help. I will try it:) – Abhilash Jul 17 '17 at 06:00

0 Answers0