2012-03-03 3 views
1

facebook 채팅 응용 프로그램을 만들려고합니다.
그리고 X-FACEBOOK-PLATFORM 메커니즘을 통해 XMPP 서버에 로그인하고 싶습니다.
그러나 인증 단계가 완료되면 실패했습니다.
DIGEST-MD5 메커니즘을 사용하면 XMPP 서버에 성공적으로 로그인 할 수 있습니다 (이 경우 JID를 [email protected]으로 사용하고 비밀번호는 내 Facebook 비밀번호로 사용)
X-FACEBOOK-PLATFORM 메커니즘 , JID를 [email protected]으로 사용했고 내 액세스 토큰, uid, 만료 날짜 등을 가져 오는 데 아무런 문제가 없었습니다.
Ofcoursely, 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"); 
    } 
} 
} 
관련 문제