get C2DM auth token without passing your password?
I'm working on a C2DM app using appengine on Python. After several hours of wondering why my "send message" was giving me an error 401 I discovered that my auth token was wrong. I've looked at several examples a开发者_开发知识库nd noticed that most people retrieve the token by passing the email address and password as request parameters example:
username = self.request.get('username')
password = self.request.get('password')
values = {'accountType' : 'HOSTED',
'Email' : username,
'Passwd' : password,
'source' : 'shiprack-brain-1',
'service' : 'ac2dm'}
data = urllib.urlencode(values)
request = urllib2.Request('https://www.google.com/accounts/
ClientLogin', data)
response = urllib2.urlopen(request)
Is there a way to get the Auth Token needed for C2DM messaging without passing your gmail password?
No.
It's recommended to use a separate account for C2DM instead of using the account used for email and other services.
精彩评论