Hi all,
I have several custom console applications for my organization's instance of Dynamics 365. I switched over to using OAuth for authentication last April because the previous connection string stopped working due to deprecation. So I changed from
-connectionString="AuthType=Office365; Username=""; Password=""; Url="" "
to
connectionString=" AuthType=OAuth; Username=""; Url=""; Password=""; AppId=51f81489-12ee-4a9e-aaae-a2591f45987d; RedirectUri=app://58145B91-0C36-4500-8554-080854F2AC97; LoginPrompt=Never;"
as recommended in the Microsoft docs
Now a year later I cannot log in through the applications, I am receiving the error in the below
ERROR REQUESTING Token FROM THE Authentication context - General ADAL Error
Federated service at https://adfs.kaust.edu.sa/adfs/services/trust/2005/usernamemixed returned error: ID3242: The security token could not be authenticated or authorized. => Response status code does not indicate success: 500 (InternalServerError). => <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"><s:Header><a:Action s:mustUnderstand="1">http://www.w3.org/2005/08/addressing/soap/fault</a:Action><a:RelatesTo>urn:uuid:b2ec290a-c4c3-4f25-a6e6-4efd5634be21</a:RelatesTo><o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><u:Timestamp u:Id="_0"><u:Created>2023-04-05T06:32:41.294Z</u:Created><u:Expires>2023-04-05T06:37:41.294Z</u:Expires></u:Timestamp></o:Security></s:Header><s:Body><s:Fault><s:Code><s:Value>s:Sender</s:Value><s:Subcode><s:Value xmlns:a="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">a:FailedAuthentication</s:Value></s:Subcode></s:Code><s:Reason><s:Text xml:lang="en-US">ID3242: The security token could not be authenticated or authorized.</s:Text></s:Reason></s:Fault></s:Body></s:Envelope>: Unknown errorUnable to connect to CRM: Response status code does not indicate success: 500 (InternalServerError).
Federated service at https://adfs.kaust.edu.sa/adfs/services/trust/2005/usernamemixed returned error: ID3242: The security token could not be authenticated or authorized. => Response status code does not indicate success: 500 (InternalServerError). => <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"><s:Header><a:Action s:mustUnderstand="1">http://www.w3.org/2005/08/addressing/soap/fault</a:Action><a:RelatesTo>urn:uuid:b2ec290a-c4c3-4f25-a6e6-4efd5634be21</a:RelatesTo><o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><u:Timestamp u:Id="_0"><u:Created>2023-04-05T06:32:41.294Z</u:Created><u:Expires>2023-04-05T06:37:41.294Z</u:Expires></u:Timestamp></o:Security></s:Header><s:Body><s:Fault><s:Code><s:Value>s:Sender</s:Value><s:Subcode><s:Value xmlns:a="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">a:FailedAuthentication</s:Value></s:Subcode></s:Code><s:Reason><s:Text xml:lang="en-US">ID3242: The security token could not be authenticated or authorized.</s:Text></s:Reason></s:Fault></s:Body></s:Envelope>: Unknown errorUnable to Login to Dynamics CRM
Unable to Login to Dynamics CRMOrganizationWebProxyClient is null
OrganizationWebProxyClient is null
I'd really appreciate it if anyone has any suggestions 🙂
Graham
Hi,
Thanks for the replies, I actually registered the app on Azure and connected using the client secret in the end.
Many thanks!
@Anonymous that app id works in all environments, not only on sandbox ones
Hello,
The app id 51f81489-12ee-4a9e-aaae-a2591f45987d only works for sandbox environments.
If you are not on a sandbox environment, you must register a new application. See https://learn.microsoft.com/en-us/power-apps/developer/data-platform/walkthrough-register-app-azure-active-directory
WarrenBelz
109
Most Valuable Professional
Michael E. Gernaey
82
Super User 2025 Season 1
mmbr1606
71
Super User 2025 Season 1