Unauthorized when calling Google GCM

£可爱£侵袭症+ 提交于 2019-11-28 10:16:38

Daniel - Dude there is an issue with the GCM documentation ! Use Browser key as the authorization key at the place of Server API key . It will work.

OK, i am just shooting in the dark here. Take a look at this line:

Request.Headers.Add(HttpRequestHeader.Authorization, "Authorization: key=AIzaSyCEygavdzrNM3pWNPtvaJXpvW66CKnjH_Y");

Shouldn't it be:

Request.Headers.Add(HttpRequestHeader.Authorization, "key=AIzaSyCEygavdzrNM3pWNPtvaJXpvW66CKnjH_Y");

Since you're telling it this is a Authorization header, there's no need to add 'Authorization: ' again, does it?

Also, make sure the string constant 'HttpRequestHeader.Authorization' is 'Authorization'.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!