Android Gcm api密钥在IPV6中身份验证失败

Android Gcm api密钥在IPV6中身份验证失败,android,push-notification,google-cloud-messaging,http-status-code-401,Android,Push Notification,Google Cloud Messaging,Http Status Code 401,我尝试使用python gcm向android设备发送推送通知,但在我的服务器上,它总是无法进行身份验证,我尝试使用服务器IP地址创建一个新的服务器api密钥,并尝试 curl --header "Authorization: key =$api_key" --header Content-Type:"application/json" https://android.googleapis.com/gcm/send -d "{\"registration_ids\":[\"ABC\"]}"

我尝试使用python gcm向android设备发送推送通知,但在我的服务器上,它总是无法进行身份验证,我尝试使用服务器IP地址创建一个新的服务器api密钥,并尝试

curl --header "Authorization: key =$api_key" --header Content-Type:"application/json" https://android.googleapis.com/gcm/send  -d "{\"registration_ids\":[\"ABC\"]}"
但它表明

<TITLE>Unauthorized</TITLE>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Unauthorized</H1>
<H2>Error 401</H2>
</BODY>
</HTML>

因此,我无法使用具有受限IP的api密钥发送通知,但它可以在不提供任何IP的情况下工作。已知的问题是服务器IP为IPV6,并发现通过IPV6发送GCM时出现一些问题。谁能帮我解决这个问题

我也有同样的问题,我已经找到了解决的办法

如果您的服务器也有IPV4地址,那么解决方案是在IPV4中工作! 您必须使用IPV4地址将其插入CURL说明中:

curl_setopt($curlh, CURLOPT_INTERFACE, "xxx.xxx.xxx.xxx");

我已禁用IPV6以解决此问题。
curl_setopt($curlh, CURLOPT_INTERFACE, "xxx.xxx.xxx.xxx");