1
votes

I am implementing a xmpp client (right now only intended for gtalk).

I started with getting an OAuth2 token as described on OAuth 2.0 Authorization. I am also looking for some help on how to connect to gtalk servers once I have got the token. I have read through the example , but not sure how SASL auth will be implemented on GAE.

Next thing, how to make it work like a chat client where real users can chat. I have seen examples using which I can make chat bots, and other examples which require user to enter their username and password to be able to chat.

But my idea is to use Google's authentication for my GAE app, and then have my app behave like a chat client for the real gtalk users. Please point me to the right direction on how to achieve this.

1

1 Answers

0
votes

I think I've hit a similar roadblock to you in implementing the gtalk XMPP client. All goes well retrieving an access token, but then I come to this part:

(pulled from https://developers.google.com/talk/jep_extensions/oauth):

<auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" 
    mechanism="X-OAUTH2"
    auth:service="oauth2"
    xmlns:auth="http://www.google.com/talk/protocol/auth">  
  base64("\0" + user_name + "\0" + oauth_token)
</auth>

It's asking for user_name. Is this the sort of problem you are encountering? Personally I've hit a roadblock at this point because obviously since it's OAuth, the username is unknown to the program. I'm not sure what google's recommendation about this is, I haven't been able to find any information.

Anyway, assuming that you can get authenticated correctly to the XMPP server, it should behave like any other XMPP server.

Some things I have discovered about the gtalk XMPP implementation which might help you or other people:

  • The server to connect to could be talk.google.com or xmpp.google.com
  • The "to" attribute of the <stream:stream> element seemingly needs to be "gmail.com" instead of the server address
  • The certificate used by the server needs to be validated as coming from "gmail.com" instead of the server address (when initiating TLS)
  • This page may help: https://developers.google.com/cloud-print/docs/rawxmpp (everything down to step#2)

Without knowing what you are coding this in, it's hard to give a direct response to your question. If you're like me, and are implementing an XMPP client from scratch, I can only wish you good luck (it will be a long journey). If however, you are using an XMPP framework to ease the burden, most of them should have built-in stuff to handle gtalk...