src/HarmonyHub/Client.cs
/// <summary>
/// Logs into Harmony device with the supplied session token.
/// </summary>
/// <param name="sessionToken">HarmonyHub session token.</param>
Logs into Harmony device with the supplied session token.
Logs into Harmony device with the supplied session token .
private void LoginToHarmony(string sessionToken)
        {
            var saslXml = Xml.Element("auth", "urn:ietf:params:xml:ns:xmpp-sasl")
                .Attr("mechanism", "PLAIN")
                .Text(Convert.ToBase64String(Encoding.UTF8.GetBytes("\0" + sessionToken + "\0" + sessionToken)));
            Send(saslXml);
            while (true)
            {
                var response = _parser.NextElement("challenge", "success", "failure");
                MessageReceived?.Invoke(this, new MessageReceivedEventArgs(response.OuterXml));
                if (response.Name != "success")
                    throw new SaslAuthenticationException("SASL authentication failed.");
                break;
            }
        }
private void LoginToHarmony ( string sessionToken ) { var saslXml = Xml . Element ( " " , " " ) . Attr ( " " , " " ) . Text ( Convert . ToBase64String ( Encoding . UTF8 . GetBytes ( " \0 " + sessionToken + " \0 " + sessionToken ) ) ) ; Send ( saslXml ) ; while ( true ) { var response = _parser . NextElement ( " " , " " , " " ) ; MessageReceived ? . Invoke ( this , new MessageReceivedEventArgs ( response . OuterXml ) ) ; if ( response . Name != " " ) throw new SaslAuthenticationException ( " " ) ; break ; } }
Logs into Harmony device with the supplied session token.
Logs into Harmony device with the supplied session token .
// <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='PLAIN'>Base64EncodedValue</auth> // Handle response
sessionToken
string
HarmonyHub session token.
HarmonyHub session token .