Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Avatar
stefan.bitola #1
Member since Dec 2011 · 4 posts
Group memberships: Members
Show profile · Link to this post
Subject: Problems with using X_MESSENGER_OAUTH2
I am trying to connect to windows live messenger through my application on Windows phone.
I've implemented the following method as suggested:

XmppClient.OnBeforeSasl += xmppClient_OnBeforeSasl;
private void xmppClient_OnBeforeSasl(object sender, SaslEventArgs e)
        {
            e.Auto = false;
            e.SaslMechanism = SaslMechanism.X_MESSENGER_OAUTH2;
            e.SaslProperties = new LiveMessengerProperties
            {
                AccessToken = AccessToken
            };
        }

There is a break point in the method xmppClient_OnBeforeSasl and the debugger never stops on this point. Also I get "Unknown To Jid in the open stream stanza" in the response from the server so I suppose that it doesn't use Sasl mechanism.

This is the initial request sent to the messenger server:
<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="xmpp.messenger.live.com" version="1.0" >
Avatar
Alex #2
Member since Feb 2003 · 4447 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
The XMPP domain must be: messenger.live.com.
According to your stream header you use xmpp.messenger.live.com which is wrong.

You have to specify the hostname manual because the Windows Phone version supports no SRV lookups.

This is the current SRV Reocrd:
priority: 10    weight: 0    port: 5222    target: beta.xmpp.messenger.live.com

So host is beta.xmpp.messenger.live.com on port 5222

When you still have problems then please post your complete XML log.
Avatar
stefan.bitola #3
Member since Dec 2011 · 4 posts
Group memberships: Members
Show profile · Link to this post
After I send the initial request to the XMPP messenger server, what is the Access Token that should be included in the message?
we get LiveOperationCompletedEventArgs object on client GetCompleted event that is dictionary containing key "id". Is the value of this key the Access token?
Avatar
Alex #4
Member since Feb 2003 · 4447 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
this depends on which API you are using to login.
You can find all Info here:
http://msdn.microsoft.com/en-us/windowslive/hh561460#acces…

With some Apis the token is in params, with others you have extract it from the redirected Url.
Avatar
stefan.bitola #5
Member since Dec 2011 · 4 posts
Group memberships: Members
Show profile · Link to this post
Alex, I am still having problem with the messenger authentication.

For loging on Windows live I am using

<my:SignInButton Name="btnSignin" ClientId="{VALID_CLIENT_ID}" Scopes="wl.messenger" RedirectUri="" Branding="Messenger" TextType="SignIn" SessionChanged="btnSignin_SessionChanged" />

On this btnSignin_SessionChanged I am getting the e.Session.AccessToken and opening the XMPP client.
The initial communication with the server is OK. The server requests the
<mechanism>X-MESSENGER-OAUTH2</mechanism>

auth and the XMPP client sends the proper response to the server. The problem is that the next response from the server is
</stream:stream>

instead
<success xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />

Do you have any suggestion what might be a problem?
Avatar
stefan.bitola #6
Member since Dec 2011 · 4 posts
Group memberships: Members
Show profile · Link to this post
As I can notice the problem is in the response to the server since there is no answer to the requested element for TTLS
<stream:features xmlns:stream="http://etherx.jabber.org/streams">
  <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls">
    <required />
  </starttls>
  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
    <mechanism>X-MESSENGER-OAUTH2</mechanism>
  </mechanisms>
</stream:features>
Here is the response:
<auth mechanism="X-MESSENGER-OAUTH2" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">[VALID ACCESS CODE]</auth>
I would try with setting the StartTls property to true but it is read only
Avatar
Alex #7
Member since Feb 2003 · 4447 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
OK, the problem is that the server requires a secure TLS connection. But WP7 supports no TLS on sockets.
So there is no way to connect without TLS support on WP7.

Alex
Avatar
mwaqas #8
Member since Mar 2012 · 10 posts · Location: Finland
Group memberships: Members
Show profile · Link to this post
So currently there is no way to connect windows live messenger service using matrix on windows phone mango?
Avatar
Alex #9
Member since Feb 2003 · 4447 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by mwaqas:
So currently there is no way to connect windows live messenger service using matrix on windows phone mango?

right, not directly. Because Windows Live requires an encrypted socket with TLS over XMPP. And this is not supported in the Mango SDK.

Possible ways to connect are:
  • You run a Xmpp or BOSH Proxy between the WM7 device and MSN server
  • Find a 3rd party library for TLS on Widows phone when there is any and use the source code version with the 3rd party TLS library.

Alex
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters: