Search code examples
androidpythonandroid-c2dmurbanairship.com

Google C2DM Authorization Token


I'm trying to set up urban airship for my android app, but I'm having trouble getting a Google C2DM Token. perhaps, I'm doing this before use C2DM according to Urban Airship Doc.

-Run “clientauth.py” on the command line (located in the “tools” directory in the distribution zip file)

When I run the file on my terminal in Mac OS X Lion, I get this errors. Could someone help me through this please? Thank you in advance!

MacBook-Pro:~ me$ python /Users/me/Documents/ua-android-lib-latest/tools/clientauth.py
C2DM Google Account: my google email for c2dm
Password for my google email for c2dm: 
Traceback (most recent call last):
  File "/Users/me/Documents/ua-android-lib-latest/tools/clientauth.py", line 46, in <module>
    ClientLoginTokenFactory().getToken()
  File "/Users/me/Documents/ua-android-lib-latest/tools/clientauth.py", line 34, in getToken
    response = urllib2.urlopen(request)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 400, in open
    response = meth(req, response)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 513, in http_response
    'http', request, response, code, msg, hdrs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 438, in error
    return self._call_chain(*args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 372, in _call_chain
    result = func(*args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 521, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 403: Forbidden

Solution

  • Before you spend too much time on this, C2DM has been deprecated. You should use Google Cloud Messaging. There's a migration guide on the Android developer website.