I have followed some debug steps elsewhere in this group to try and
find the cause of the 401 Unauthorized error, but I'm not having any
luck. This is what I'm sending
curl --trace-ascii - -d
"registration_id=<INSERT_REG_ID_HERE>&collapse_key=foo&data.key1=bar&delay_
while_idle=1" -H "Authorization: GoogleLogin auth=KEY"
http://android.apis.google.com/c2dm/send
I have not replaced <INSERT_REG_ID_HERE> with anything as I have yet
to get past the 401 error. I understand this is incorrect but it
should provide a different error.
I am replacing KEY in the Authorization header with my ClientLogin
key.
I'm using the Google account
da...@boxedice.com which is what I used
to register for C2DM.
== Info: About to connect() to
android.apis.google.com port 80 (#0)
== Info: Trying 209.85.229.100... == Info: connected
== Info: Connected to
android.apis.google.com (209.85.229.100) port 80
(#0)
=> Send header, 494 bytes (0x1ee)
0000: POST /c2dm/send HTTP/1.1
001a: User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.1
005a: 9.7 OpenSSL/0.9.8l zlib/1.2.3
0079: Host:
android.apis.google.com
0098: Accept: */*
00a5: Authorization: GoogleLogin auth=KEY
01a7: Content-Length: 87
01bb: Content-Type: application/x-www-form-urlencoded
01ec:
=> Send data, 87 bytes (0x57)
0000: registration_id=<INSERT_REG_ID_HERE>&collapse_key=foo&data.key1=
0040: bar&delay_ while_idle=1
<= Recv header, 27 bytes (0x1b)
0000: HTTP/1.1 401 Unauthorized
<= Recv header, 40 bytes (0x28)
0000: Content-Type: text/html; charset=UTF-8
<= Recv header, 37 bytes (0x25)
0000: Date: Wed, 06 Oct 2010 15:58:02 GMT
<= Recv header, 40 bytes (0x28)
0000: Expires: Wed, 06 Oct 2010 15:58:02 GMT
<= Recv header, 35 bytes (0x23)
0000: Cache-Control: private, max-age=0
<= Recv header, 33 bytes (0x21)
0000: X-Content-Type-Options: nosniff
<= Recv header, 29 bytes (0x1d)
0000: X-Frame-Options: SAMEORIGIN
<= Recv header, 33 bytes (0x21)
0000: X-XSS-Protection: 1; mode=block
<= Recv header, 13 bytes (0xd)
0000: Server: GSE
<= Recv header, 28 bytes (0x1c)
0000: Transfer-Encoding: chunked
<= Recv header, 2 bytes (0x2)
0000:
<= Recv data, 158 bytes (0x9e)
0000: 93
0004: <HTML>.<HEAD>.<TITLE>Unauthorized</TITLE>.</HEAD>.<BODY BGCOLOR=
0044: "#FFFFFF" TEXT="#000000">.<H1>Unauthorized</H1>.<H2>Error 401</H
0084: 2>.</BODY>.</HTML>.
0099: 0
009c:
<HTML>
<HEAD>
<TITLE>Unauthorized</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Unauthorized</H1>
<H2>Error 401</H2>
</BODY>
</HTML>
== Info: Connection #0 to host
android.apis.google.com left intact
== Info: Closing connection #0