【发布时间】:2019-06-12 09:44:31
【问题描述】:
我正在尝试使用 Openssl TLS 连接到 FCM XMPP 服务器
我已经注册了一个项目并拥有一个服务器密钥和发件人 ID。我按照https://firebase.google.com/docs/cloud-messaging/auth-server#authorize_an_xmpp_connection中的注释进行操作
我所有的代码都在 C 中使用 openssl。
以下是我的 App Server 和 FCM-XMPP Server 之间的通信 应用服务器到 FCM-XMPP:
<stream:stream to='fcm-xmpp.googleapis.com' version='1.0' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams'>
来自 FCM-XMPP 服务器:
<stream:stream from="fcm-xmpp.googleapis.com" id="E1204B9D567A6A8A" version="1.0" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client">
<stream:features><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>X-OAUTH2</mechanism><mechanism>X-GOOGLE-TOKEN</mechanism><mechanism>PLAIN</mechanism></mechanisms></stream:features>
应用服务器到 FCM-XMPP:
<auth mechanism='PLAIN' xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>base 64 encoding of <null>sendID@fcm-xmpp.googleapis.com<null>serverKey</auth>
来自 FCM-XMPP 服务器:
<failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/></failure>
我有一个与 GCM-XMPP 服务器通信的应用服务器。我运行基本相同的代码,我得到了
<success xmlns="urn:ietf:params:xml:ns:xmpp-sasl"/>
【问题讨论】:
标签: c firebase openssl firebase-cloud-messaging xmpp