2012-03-03 8 views
1

Facebookチャットアプリケーションを作成しようとしています。
X-FACEBOOK-PLATFORMメカニズムを介してXMPPサーバーにログインします。
しかし、私は認証手順を取ったときに失敗しました。
DIGEST-MD5メカニズムを使用すると、XMPPサーバーに正常にログインできます(この場合、私はfacebookパスワードとして[email protected]とPasswordとしてJIDを使用しました)
X-FACEBOOK-PLATFORMメカニズム私はJIDを[email protected]として使用しました。アクセストークン、uid、有効期限などを取得することに問題はありませんでした。
もちろん、私はfacebookから 'xmpp_login'の許可を得ています。X-FACEBOOK-PLATFORMメカニズムを使用するとXMPP認証が失敗する

何が間違っていましたか?

ここに、デコードされたログメッセージがあります。

AppDelegate: xmppStream:socketDidConnect: 
SEND: <?xml version='1.0'?> 
SEND: <stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' to='chat.facebook.com'> 
RECV: <stream:stream xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" id="FAA1CDE5" from="chat.facebook.com" version="1.0" stream1:lang="en"/> 
RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams"><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>X-FACEBOOK-PLATFORM</mechanism><mechanism>DIGEST-MD5</mechanism></mechanisms></stream:features> 
SEND: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='X-FACEBOOK-PLATFORM'/> 
XMPPCapabilities: My capabilities: 
<query xmlns="http://jabber.org/protocol/disco#info"> 
    <feature var="http://jabber.org/protocol/disco#info"/> 
    <feature var="http://jabber.org/protocol/caps"/> 
</query> 
RECV: <challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl"> 
     version=1&method=auth.xmpp_login&nonce=0E51AA2E42C4AF8FCE9D996F347C7019</challenge> 
SEND: <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl"> 
    method=auth.xmpp_login&nonce=0E51AA2E42C4AF8FCE9D996F347C7019&access_token=BAAEctIrR99oBAM9ZBymJSDmVZAYb82RX634ANVZCQ9VJeoD9ZCTqSGVyuxSQfbm9s92VGtwcewVJlP7C8CnIglkqZBCvq6ZBxxWhJoDmK0rPJGdM5i7KRu18bZAJoyKEI0ZD 
    &api_key=313036725417946 
    &call_id=150701328 
    &v=1.0</response> 
RECV: <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/></failure> 
AppDelegate: xmppStream:didNotAuthenticate: 
AppDelegate: xmppStreamDidDisconnect:withError: 
+0

あなたが問題を解決したの前にxmppstreamを確保することで、問題を解決しましたか? – Hunt

+0

いいえ、まだ解決できません。 – manutd

答えて

2

私はまた、同様の問題に直面し、認証

-(void)xmppStreamDidConnect:(XMPPStream *)sender{ 

DDLogVerbose(@"%@: %@", THIS_FILE, THIS_METHOD); 

isXmppConnected = YES; 

if (![xmppStream isSecure]) 
{ 
    NSError *error = nil; 
    BOOL result = [xmppStream secureConnection:&error]; 

    if (result == NO) 
    { 
     DDLogError(@"%@: Error in xmpp STARTTLS: %@", THIS_FILE, error); 
     NSLog(@"XMPP STARTTLS failed"); 
    } 
} 
else 
{ 
    NSError *error = nil; 
    BOOL result = [xmppStream authenticateWithFacebookAccessToken:[NSString stringWithFormat:@"%@",FBSession.activeSession.accessTokenData] error:&error]; 

    if (result == NO) 
    { 
     DDLogError(@"%@: Error in xmpp auth: %@", THIS_FILE, error); 
     NSLog(@"XMPP authentication failed"); 
    } 
} 
} 
関連する問題