我正在尝试实现一个启用GCM的Android应用程序,但我在尝试从我的第三方服务器验证CCS服务器时遇到了问题。
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()
输出:
Connection established.
Authenticated = False
Process finished with exit code 0
不确定为什么client.authenticated
一直是false,当我知道我拥有的凭据与Google开发者控制台项目页面上的凭据相同时。