Search code examples
androidgoogle-apiandroid-c2dm

Who provides AUTH token to use with C2DM?


I'm developping some kind of IM application for iPhone/WP7/Android.

After reading documentation I'm not sure, that understand right what credentials I must use, to authentificate my backend on ac2dm service. In chrometophone server uses user's auth token, but my client's application is not linked with google at all. Should I create Activity, that asks user to enter their google accound credentials, or I can use my own account to send notifications to c2dm?


Solution

  • The sender id is not the "real" user (that gets notified), but an account authorizing your web application for using c2dm. It is the role based account specified on the c2dm signup page.

    The authToken has to be generated with ClientLogin, for example:

    curl https://www.google.com/accounts/ClientLogin       \ 
       -d [email protected] -d Passwd=my-pass         \
       -d accountType=HOSTED_OR_GOOGLE                     \
       -d source=companyName-applicationName-version       \
       -d service=ac2dm
    

    See also - ClientLogin request. If the account has 2-step verification enabled, the password must be application-specific. See also this question.