ConnectyCube / connectycube-flutter-sdk-releases

ConnectyCube Flutter SDK Releases
7 stars 1 forks source link

Unhandled Exception: ChatConnectionException: Open connection error: AuthenticationFailure #26

Closed emrade closed 3 years ago

emrade commented 3 years ago

Platform (use [x]) [x] Android [x] iOS

Device info Manufacture: [e.g. Apple inc, Samsung] Model: [e.g. iPhone 12, Samsung A70] OS version: [e.g. iOS 14, Android 10]

Describe the bug: Running the function

CubeChatConnection.instance.login(
  CubeUser(login: email, password: password),
);

Gives the error message "Unhandled Exception: ChatConnectionException: Open connection error: AuthenticationFailure"

Full Code:

if (!CubeSessionManager.instance.isActiveSessionValid()) {
   await createSession(
     CubeUser(login: email, password: password,
   );
}
 await CubeChatConnection.instance.login(
    CubeUser(login: email, password: password),
 );

Logs:

flutter: sending: <?xml version='1.0'?>
<stream:stream xmlns='jabber:client' version='1.0' xmlns:stream='http://etherx.jabber.org/streams'
to='chat.connectycube.com'
xml:lang='en'
>
flutter: State: XmppConnectionState.SocketOpening
flutter: CB-SDK: CubeChatConnection: Chat connection SocketOpening
flutter: response: <xmpp_stone><?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' from='chat.connectycube.com' id='e145e893-85d8-47eb-a299-407133488b8a' version='1.0' xml:lang='en'></stream></xmpp_stone>
flutter: processInitialStream
flutter: response: <xmpp_stone><stream:features><sm xmlns="urn:xmpp:sm:3"/><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism>ANONYMOUS</mechanism><mechanism>PLAIN_FAST</mechanism></mechanisms><ver xmlns="urn:xmpp:features:rosterver"/><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression></stream:features></xmpp_stone>
flutter: Negotating features
flutter: ELEMENT true
flutter: negotiating starttls
flutter: sending: <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>
flutter: Feature Started Parsing
flutter: response: <xmpp_stone><proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls"/></xmpp_stone>
flutter: startSecureSocket
flutter: XmppConnectionState.SocketOpening
flutter: sending: <?xml version='1.0'?>
<stream:stream xmlns='jabber:client' version='1.0' xmlns:stream='http://etherx.jabber.org/streams'
to='chat.connectycube.com'
xml:lang='en'
>
flutter: response: <xmpp_stone><?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' from='chat.connectycube.com' id='e145e893-85d8-47eb-a299-407133488b8a' version='1.0' xml:lang='en'></stream></xmpp_stone>
flutter: processInitialStream
flutter: response: <xmpp_stone><stream:features><sm xmlns="urn:xmpp:sm:3"/><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism>ANONYMOUS</mechanism><mechanism>PLAIN_FAST</mechanism></mechanisms><ver xmlns="urn:xmpp:features:rosterver"/><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression></stream:features></xmpp_stone>
flutter: Negotating features
flutter: ELEMENT true
flutter: sending: <auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="PLAIN">AG51bGwtMjkwMwBDNjBFVEVhanlYWXJNd0ltZ09sRGZkY0VMMjEz</auth>
flutter: Feature Started Parsing
flutter: response: <xmpp_stone><failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/></failure></xmpp_stone>
flutter: State: XmppConnectionState.AuthenticationFailure
flutter: State: XmppConnectionState.Closed
flutter: CB-SDK: CubeChatConnection: Chat connection AuthenticationFailure
flutter: ELEMENT true
[VERBOSE-2:ui_dart_state.cc(177)] Unhandled Exception: ChatConnectionException: Open connection error: AuthenticationFailure
flutter: CB-SDK: CubeChatConnection: Chat connection Closed
flutter: response: <xmpp_stone></stream:stream></stream></xmpp_stone>
flutter: !!!!!!!!!!!Handle secured connection done
TatankaConCube commented 3 years ago

it happens because you didn't set id for CubeUser before the login to the chat

emrade commented 3 years ago

That solved it. Thank you.