h_h
h_h

Reputation: 1231

React native push notifications, GCM server returning 401

I have been using this npm module in my React native project https://github.com/zo0r/react-native-push-notification for push notifications. On Ios everything is working fine. but on Android I am not able to send push message from my php server. However I am successfully getting device token on my Android device. I am using Api key on php side and getting error 401 unauthorised. My php code is copied from here https://gist.github.com/prime31/5675017

Any help?

Upvotes: 0

Views: 528

Answers (1)

Umang
Umang

Reputation: 1070

Error code 401 means the sender account used to send a message couldn't be authenticated. Possible causes are: 1. Authorization header missing or with invalid syntax in HTTP request. 2. Invalid project number sent as key. 3. Key valid but with GCM service disabled. 4. Request originated from a server not whitelisted in the Server Key IPs.

Refer to this doc for more details

Upvotes: 0

Related Questions