web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

AADSTS70002: Error validating credentials. AADSTS50126: Invalid username or password

(0) ShareShare
ReportReport
Posted on by 85

I have online CRM which is configure through adfs. When i am trying to access this api  "https://XXXXXX.api.crm.dynamics.com". I am getting error: AADSTS70002: Error validating credentials. AADSTS50126: Invalid username or password. one thing more, this is accessible through c# code not working for python code.  All other orgs are connected successfully which are not configure through adfs.  I am using python for accessing this api. Below are the request and response.

request:XML Trace

Sending...
login.microsoftonline.com/RST2.srf
{'SOAPAction': 'schemas.microsoft.com/.../Execute', 'Content-Type': 'application/soap+xml; charset=UTF-8', 'Content-Length': '1429'}
<?xml version="1.0" ?>
<s:Envelope xmlns:a="www.w3.org/.../addressing" xmlns:s="www.w3.org/.../soap-envelope" xmlns:u="docs.oasis-open.org/.../oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<a:Action s:mustUnderstand="1">schemas.xmlsoap.org/.../Issue&lt;/a:Action>
<a:MessageID>urn:uuid:38610047-b964-435e-b8f7-9f929b70063c</a:MessageID>
<a:ReplyTo>
<a:Address>www.w3.org/.../anonymous&lt;/a:Address>
</a:ReplyTo>
<a:To s:mustUnderstand="1">login.microsoftonline.com/RST2.srf&lt;/a:To>
<o:Security s:mustUnderstand="1" xmlns:o="docs.oasis-open.org/.../oasis-200401-wss-wssecurity-secext-1.0.xsd">
<u:Timestamp u:Id="_0">
<u:Created>2019-01-22T00:52:00.340817-05:00</u:Created>
<u:Expires>2019-01-22T01:12:00.340817-05:00</u:Expires>
</u:Timestamp>
<o:UsernameToken u:Id="uuid-38610047-b964-435e-b8f7-9f929b70063c-1">
<o:Username>XXXX.com</o:Username>
<o:Password>XXXXX</o:Password>
</o:UsernameToken>
</o:Security>
</s:Header>
<s:Body>
<trust:RequestSecurityToken xmlns:trust="schemas.xmlsoap.org/.../trust">
<wsp:AppliesTo xmlns:wsp="schemas.xmlsoap.org/.../policy">
<a:EndpointReference>
<a:Address>urn:crmna:dynamics.com</a:Address>
</a:EndpointReference>
</wsp:AppliesTo>
<trust:RequestType>schemas.xmlsoap.org/.../Issue&lt;/trust:RequestType>
</trust:RequestSecurityToken>
</s:Body>
</s:Envelope>

Response:

Receiving...
{'cache-control': 'private', 'content-type': 'application/soap+xml; charset=utf-8', 'strict-transport-security': 'max-age=31536000; includeSubDomains', 'x-content-type-options': 'nosniff', 'x-ms-request-id': '9b4aa25a-1405-4cf2-8fb2-1d5a06c6cb00', 'p3p': 'CP="DSP CUR OTPi IND OTRi ONL FIN"', 'set-cookie': 'fpc=AZFtxeP7O6xLsw__MDk_o9E7M9J7AQApgaJXL4DWCA; expires=Thu, 21-Feb-2019 06:03:34 GMT; path=/; secure; HttpOnly, x-ms-gateway-slice=011; path=/; secure; HttpOnly, stsservicecookie=ests; path=/; secure; HttpOnly', 'date': 'Tue, 22 Jan 2019 06:03:33 GMT', 'content-length': '1435'}
<?xml version="1.0" ?>
<S:Envelope xmlns:S="www.w3.org/.../soap-envelope" xmlns:wsa="www.w3.org/.../addressing" xmlns:wsp="schemas.xmlsoap.org/.../policy" xmlns:wsse="docs.oasis-open.org/.../oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wst="schemas.xmlsoap.org/.../trust" xmlns:wsu="docs.oasis-open.org/.../oasis-200401-wss-wssecurity-utility-1.0.xsd">
<S:Header>
<psf:pp xmlns:psf="schemas.microsoft.com/.../SOAPFault">
<psf:serverVersion>1</psf:serverVersion>
<psf:authstate>0x80048800</psf:authstate>
<psf:reqstatus>0x80048821</psf:reqstatus>
<psf:serverInfo ServerTime="2019-01-22T06:03:34.2683765Z">PROD-WST-011.ProdSlices rid:9b4aa25a-1405-4cf2-8fb2-1d5a06c6cb00</psf:serverInfo>
</psf:pp>
</S:Header>
<S:Body xmlns:S="www.w3.org/.../soap-envelope">
<S:Fault>
<S:Code>
<S:Value>S:Sender</S:Value>
<S:Subcode>
<S:Value>wst:FailedAuthentication</S:Value>
</S:Subcode>
</S:Code>
<S:Reason>
<S:Text xml:lang="en-US">Authentication Failure</S:Text>
</S:Reason>
<S:Detail>
<psf:error xmlns:psf="schemas.microsoft.com/.../SOAPFault">
<psf:value>0x80048821</psf:value>
<psf:internalerror>
<psf:code>0x80048821</psf:code>
<psf:text>AADSTS70002: Error validating credentials. AADSTS50126: Invalid username or password</psf:text>
</psf:internalerror>
</psf:error>
</S:Detail>
</S:Fault>
</S:Body>
</S:Envelope>

*************
b'<S:Fault xmlns:S="www.w3.org/.../soap-envelope" xmlns:wsa="www.w3.org/.../addressing" xmlns:wsse="docs.oasis-open.org/.../oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="docs.oasis-open.org/.../oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="schemas.xmlsoap.org/.../policy" xmlns:wst="schemas.xmlsoap.org/.../trust"><S:Code><S:Value>S:Sender</S:Value><S:Subcode><S:Value>wst:FailedAuthentication</S:Value></S:Subcode></S:Code><S:Reason><S:Text xml:lang="en-US">Authentication Failure</S:Text></S:Reason><S:Detail><psf:error xmlns:psf="schemas.microsoft.com/.../SOAPFault"><psf:value>0x80048821</psf:value><psf:internalerror><psf:code>0x80048821</psf:code><psf:text>AADSTS70002: Error validating credentials. AADSTS50126: Invalid username or password</psf:text></psf:internalerror></psf:error></S:Detail></S:Fault>'
Traceback (most recent call last):
File "run_test.py", line 20, in <module>
em = c.get_entity_mapping(entity)
File "C:\Program Files\Python37\lib\datasource\msdcrm\__init__.py", line 388, in get_entity_mapping
if isinstance(resp, errors.ParseFault): self._raise_parse_error(resp)
File "C:\Program Files\Python37\lib\datasource\msdcrm\__init__.py", line 442, in _raise_parse_error
raise errors.CredentialsError(parsed_fault.get('faultstring', 'Credentials Error'))
datasource.errors.CredentialsError: 'Authentication Failure'

*This post is locked for comments

I have the same question (0)
  • EL IDRISSI Profile Picture
    10 on at

    Same problem here, any solutions ?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans