Sorry to bring this up again but I just spend hours reading all the
posts regarding 401 Unauthorized messages. I double checked my
applications but all with no luck. I keep getting 401 Unauthorized. So
hope someone sees what goes wrong here
1. I registered with the role account <myc2dmaccount>
2. From my Android I register the device with the google lib
com.google.android.c2dm the sender id is set to the <myc2dmaccount> .
I receive a registration id.
3. I request a authorization token from my server app. Below the
request logged with fiddler:
POST
https://www.google.com/accounts/ClientLogin HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Host:
www.google.com
Content-Length: 116
Expect: 100-continue
accountType=HOSTED_OR_GOOGLE&Email=<myc2dmaccount>&Passwd=<myPassword>=ac2dm&source=<Android
app packagename>
This returns a authorization ID
4. I now call the send api like:
POST
https://android.apis.google.com/c2dm/send HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Authorization: GoogleLogin auth=<Authorization token>
Host:
android.apis.google.com
Content-Length: 155
Expect: 100-continue
registration_id=<registration id>&collapse_key=group1
the response I get is:
HTTP/1.1 401 Unauthorized
Update-Client-Auth: <a token>
Set-Cookie: DO_NOT_CACHE_RESPONSE=true;Expires=Wed, 29-Sep-2010
08:48:12 GMT
Content-Type: text/html; charset=UTF-8
Date: Wed, 29 Sep 2010 08:48:11 GMT
Expires: Wed, 29 Sep 2010 08:48:11 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Content-Length: 147
<HTML>
<HEAD>
<TITLE>Unauthorized</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Unauthorized</H1>
<H2>Error 401</H2>
</BODY>
</HTML>
What is wrong here?