Cannot Authenticate GCM CCS Server

I am trying to implement an Android app with GCM support, but I am having problems authenticating with the CCS server from my third-party server.

import sleekxmpp as xmpp

SERVER = 'gcm.googleapis.com'
PORT = 5235
USERNAME = 'my-project-number'
PASSWORD = 'my-api-key'


def main():
    client = xmpp.ClientXMPP(USERNAME + '@' + SERVER, PASSWORD)
    if client.connect(address=(SERVER, PORT), use_ssl=True):
        print('Connection established.')
        print('Authenticated =', client.authenticated)
    else:
        print('Connection failed.')


if __name__ == "__main__":
    main()

Conclusion:

Connection established.
Authenticated = False

Process finished with exit code 0

Not sure why client.authenticatedit is always false when I know that the credentials that I have are the same on the project page in the Google Developer Console.

+4
source share
1 answer

Since you really did not provide a specific error message from the logs, I will post a quick troubleshooting here. I used it myself when I had problems.

  • Ip server

IP- : IP- . API, , .

  1. Whitelisting

xmpp, , Google. : Google CCS (GCM) - . : https://services.google.com/fb/forms/gcm/

  1. Http

, , , HTTP- json, . , , : https://bitbucket.org/sardarnl/gcm-client

+1

All Articles