anchor.diff:              throw({expected_challenge, got, Challenge})
       end.
   
  +%% Throws!
  +-spec wait_for_success(any(), client()) -> ok.
   wait_for_success(Username, Conn) ->
       AuthReply = escalus_connection:get_stanza(Conn, auth_reply),
       case AuthReply#xmlel.name of
  
positive.code:             throw({auth_failed, Username, AuthReply})
      end.
  
  
  auth_sasl_anon(Conn, Props) ->
      Stanza = escalus_stanza:auth(<<"ANONYMOUS">>),
      ok = escalus_connection:send(Conn, Stanza),
      wait_for_success(get_property(username, Props), Conn).
  
  auth_sasl_external(Conn, Props) ->
      {server, ThisServer} = get_property(endpoint, Props),
      Stanza = escalus_stanza:auth(<<"EXTERNAL">>, [base64_cdata(ThisServer)]),
      ok = escalus_connection:send(Conn, Stanza),
      wait_for_success(ThisServer, Conn).
  
  auth_sasl_oauth(Conn, Props) ->
      Token = get_property(oauth_token, Props),
      Children = [#xmlcdata{content = base64:encode(Token)}],
  
negative.code: -export([get_challenge/2,
           wait_for_success/2]).
  
  %% Some shorthands
  -type client() :: escalus_connection:client().
  -type user_spec() :: escalus_users:user_spec().
  
  -include_lib("exml/include/exml.hrl").
  -include("no_binary_to_integer.hrl").
  
  