title: Azure ADAL for Python - facing issue with acquire_token_with_username_password method
body: <p>I am trying to retrieve access token using azure user id and password .
  Initially I tried with the following python code block </p>
  
  <pre><code>import adal
  context = adal.AuthenticationContext(AUTHORITY)
  token = context.acquire_token_with_client_credentials(
      "https://management.azure.com/",
      CLIENT_ID,
      CLIENT_SECRET)
  </code></pre>
  
  <p>This is returning the token without any issue .
  I am following an example from <a href="https://github.com/AzureAD/azure-activedirectory-library-for-python" rel="nofollow noreferrer">https://github.com/AzureAD/azure-activedirectory-library-for-python</a> for retrieving the token using username and password and the code block is the the following</p>
  
  <pre><code>token2 = context.acquire_token_with_username_password("https://management.azure.com/",USER_NAME,PASSWORD,CLIENT_ID)
  </code></pre>
  
  <p>In this case ,no token is returned , instead following response is returned .</p>
  
  <pre><code>File "F:\All_Python\Python_Setup\Python27\lib\site-packages\adal\authentication_context.py", line 145, in acquire_token_with_username_password
      return self._acquire_token(token_func)
    File "F:\All_Python\Python_Setup\Python27\lib\site-packages\adal\authentication_context.py", line 109, in _acquire_token
      return token_func(self)
    File "F:\All_Python\Python_Setup\Python27\lib\site-packages\adal\authentication_context.py", line 143, in token_func
      return token_request.get_token_with_username_password(username, password)
    File "F:\All_Python\Python_Setup\Python27\lib\site-packages\adal\token_request.py", line 286, in get_token_with_username_password
      token = self._get_token_username_password_federated(username, password)
    File "F:\All_Python\Python_Setup\Python27\lib\site-packages\adal\token_request.py", line 252, in _get_token_username_password_federated
      username, password)
    File "F:\All_Python\Python_Setup\Python27\lib\site-packages\adal\token_request.py", line 211, in _perform_username_password_for_access_token_exchange
      username, password)
    File "F:\All_Python\Python_Setup\Python27\lib\site-packages\adal\token_request.py", line 198, in _perform_wstrust_exchange
      result = wstrust.acquire_token(username, password)
    File "F:\All_Python\Python_Setup\Python27\lib\site-packages\adal\wstrust_request.py", line 160, in acquire_token
      raise AdalError(return_error_string, error_response)
  adal.adal_error.AdalError: WS-Trust RST request returned http error: 500 and server response: &lt;s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"&gt;&lt;s:Header&gt;&lt;a:Action s:mustUnderstand="1"&gt;http://www.w3.org/2005/08/addressing/soap/fault&lt;/a:Action&gt;&lt;o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"&gt;&lt;u:Timestamp u:Id="_0"&gt;&lt;u:Created&gt;2017-06-07T12:12:56.567Z&lt;/u:Created&gt;&lt;u:Expires&gt;2017-06-07T12:17:56.567Z&lt;/u:Expires&gt;&lt;/u:Timestamp&gt;&lt;/o:Security&gt;&lt;/s:Header&gt;&lt;s:Body&gt;&lt;s:Fault&gt;&lt;s:Code&gt;&lt;s:Value&gt;s:Sender&lt;/s:Value&gt;&lt;s:Subcode&gt;&lt;s:Value xmlns:a="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"&gt;a:FailedAuthentication&lt;/s:Value&gt;&lt;/s:Subcode&gt;&lt;/s:Code&gt;&lt;s:Reason&gt;&lt;s:Text xml:lang="en-US"&gt;ID3242: The security token could not be authenticated or authorized.&lt;/s:Text&gt;&lt;/s:Reason&gt;&lt;/s:Fault&gt;&lt;/s:Body&gt;&lt;/s:Envelope&gt;
  
  Process finished with exit code 1
  </code></pre>
  
  <p>If anybody has any idea on this, please let me know .</p>