The remote server returned an error: (401) Unauthorized

2,496 views
Skip to first unread message

Jafer P

unread,
Jul 6, 2016, 12:20:50ā€ÆPM7/6/16
to android-gcm
I am getting this error when I run the code in windows server r2 2012 ,I have used c#.Net Ā .The error isĀ 

The remote server returned an error: (401) Unauthorized

Diego Giorgini

unread,
Jul 6, 2016, 12:48:24ā€ÆPM7/6/16
to android-gcm
Hi Jafer,

please check that you are using aĀ server typeĀ api-key, and not a client api-key.
If you are using Firebase you can find the API-KEY in Project Settings > Cloud Messaging
If you are using cloud console, orĀ you are not sure which key you are using,Ā 
you can generate a new key through throughĀ https://console.cloud.google.comĀ 

More documentation see: "Server key"Ā here:

On Wed, Jul 6, 2016 at 9:20 AM Jafer P <jafer...@gmail.com> wrote:
I am getting this error when I run the code in windows server r2 2012 ,I have used c#.Net Ā .The error isĀ 

The remote server returned an error: (401) Unauthorized

--
You received this message because you are subscribed to the Google Groups "android-gcm" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-gcm...@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-gcm/e1f75b44-fc6f-428f-aae6-f70514c76d03%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jafer P

unread,
Jul 6, 2016, 12:58:21ā€ÆPM7/6/16
to andro...@googlegroups.com
My Server API Key is :AIzaSyDgtno6MjfOjKqNXm49wo2L2ReS7sbvy5k
Sender Id is :Ā 128998817970

Few weeks back it was working.The API Key was created by our previous vendor.


--
You received this message because you are subscribed to a topic in the Google Groups "android-gcm" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/android-gcm/2Wf8p1tG-mg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to android-gcm...@googlegroups.com.

To post to this group, send email to andro...@googlegroups.com.

Diego Giorgini

unread,
Jul 6, 2016, 1:15:39ā€ÆPM7/6/16
to andro...@googlegroups.com
You should never post your API-KEY publicly. The API-KEY is the same as a password and should be kept secret.
Please CHANGE your API-KEY ASAP.

I have no way to check what type was your key.
Since you now have to generate a new one, be sure to generate a type serverĀ API-KEY, as explain in the documentation.
https://firebase.google.com/docs/cloud-messaging/concept-options#credentialsĀ 

If you don't have access to the Cloud Console project, you have to contact your previous vendor and ask to generate a new key.
Alternatively you can try to contactĀ https://cloud.google.com/support/

jafer.p986

unread,
Jul 6, 2016, 1:34:14ā€ÆPM7/6/16
to andro...@googlegroups.com
They are not even contact Ā with us, do we know whether the API key is existing




Sent from Samsung tablet
Reply all
Reply to author
Forward
0 new messages