React本机推送通知,GCM服务器返回401

问题描述 投票:0回答:1

我一直在我的React本机项目https://github.com/zo0r/react-native-push-notification中使用这个npm模块进行推送通知。在Ios上一切正常。但在Android上我无法从我的php服务器发送推送消息。但是我在Android设备上成功获取了设备令牌。我在php端使用Api密钥并且未经授权而获得错误401。我的PHP代码是从这里复制https://gist.github.com/prime31/5675017

有帮助吗?

php reactjs react-native push-notification google-cloud-messaging
1个回答
0
投票

错误代码401表示无法验证用于发送邮件的发件人帐户。可能的原因是:1。HTTP请求中缺少授权标头或语法无效。 2.作为密钥发送的项目编号无效。 3.密钥有效但GCM服务已禁用。 4.请求源自服务器密钥IP中未列入白名单的服务器。

有关更多详细信息,请参阅this doc

© www.soinside.com 2019 - 2024. All rights reserved.