简体   繁体   English

使用 authToken 对 Google Talk(XMPP、Smack)进行身份验证

[英]Authenticate to Google Talk (XMPP, Smack) using an authToken

The app I'm writing is connecting to a XMPP server, and if the user chooses, I want to give them the option to connect to their google chat account, without having to enter the credentials...我正在编写的应用程序正在连接到 XMPP 服务器,如果用户选择,我想让他们选择连接到他们的谷歌聊天帐户,而无需输入凭据......

To do this, I'd get the permission to use the google account, get the token and authenticate to google talk (XMPP server, using Smack) using the token..为此,我将获得使用 google 帐户的权限,获取令牌并使用令牌对 google talk(XMPP 服务器,使用 Smack)进行身份验证。

The problem is.. how do I do that?问题是..我该怎么做? I mean, how do I authenticate to the GTalk server if I know the login and the token?我的意思是,如果我知道登录名和令牌,如何向 GTalk 服务器进行身份验证?

Any ideas, insights?有什么想法、见解吗? :) :)
If not, maybe anyone knows where could I find someone that knows?如果没有,也许有人知道我在哪里可以找到知道的人? (Google contacts, anyone? :P ) (谷歌联系人,有人吗?:P)

You're looking for documentation on the X-GOOGLE-TOKEN SASL mechanism.您正在寻找有关 X-GOOGLE-TOKEN SASL 机制的文档。 This should be the beginning.应该是开始。 Use service=mail:使用服务=邮件:

https://www.google.com/accounts/ClientLogin?
    accountType=GOOGLE&
    Email=YOURUSERNAME@gmail.com&
    Passwd=YOURPASSWORD&
    service=mail

Which will return 200 OK and three values:这将返回200 OK和三个值:

SID=<long string>
LSID=<long string>
Auth=<long string>

Parse out the Auth string, then construct a string with this form:解析出 Auth 字符串,然后用这种形式构造一个字符串:

jidAndToken ="\0" + UTF8(YOURUSERNAME@gmail.com) + "\0" + Auth

(where "\0" is intended to be a single octet with value zero). (其中“\0”旨在成为一个值为 0 的八位字节)。 Use this in the initial SASL auth:在初始 SASL 身份验证中使用它:

<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' 
      mechanism='X-GOOGLE-TOKEN'>Base64(jidAndToken)</auth>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM