Personalized Community is here!
Quickly customize your community to find the content you seek.
Have questions on moving to the cloud? Visit the Dynamics 365 Migration Community today! Microsoft’s extensive network of Dynamics AX and Dynamics CRM experts can help.
2022 Release Wave 2Check out the latest updates and new features of Dynamics 365 released from October 2022 through March 2023
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Community | FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Upcoming TechTalks | All TechTalks
Has anyone gotten the Method DiscoverAuthority from the following sample to work with ADFS?
I keep getting this error: Invalid authenticate header format
I presume is because the response.headers["WWW-Authenticate"] contains ",Negotiate,NTLM" and thus the cast Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationParameters. CreateFromResponseAuthenticateHeader((response.Headers)["WWW-Authenticate"]); returns null
I got it to work by hardocding the oauth URL to https://[adfsurl]/adfs/ls instead of https://<serverFQDNaddress>/adfs/ls/XRMServices/2011/Organization.svc/web as the sample explains.
any insights would be great.
Forgot the link to the sample
"..the following sample.." Which one are you referring to? This one msdn.microsoft.com/.../dn481599.aspx ?
The sample is quite old and needs to be updated. For example, it uses the preview ADAL NuGet package instead of the latest. There have been some ADAL API changes in the latest packages so the sample update is not simply to install the latest package. I have added the update as an action item for me.
The OAuth URL is wrong in the SDK topic and will be fixed in the next release.
Try this one liner instead of calling the DiscoverAuthority method:
AuthenticationParameters parameters = await AuthenticationParameters.CreateFromResourceUrlAsync(serviceUrl);
string _oauthUrl = parameters.Authority;
Let me know if this works for you.
Peter Hecke | Microsoft CRM SDK team
I changed my code to use the sample you provided below and it worked for a while running my code from the VS debugger and now if only works when I run the app deployed on tablets if I run it from VS I get the following error
Unauthorized Http Status Code (401) was expected in the response
I tried uninstalling and reinstalling ADFS. Repairing CRM and I still get that error any ideas?
If anyone has this issue make sure that the capabilities of the app are internetclient and that the enable loopback is set on the debugger.
Unfortunately, I have not seen this happen. When you try to call a web method, if the correct access token in the Authorization header is not supplied, you will get a 401 response, which is expected. From that response you parse the Authority URL. This is the normal flow. Make sure you are adding the SdkClientVersion parameter to your request URL. See msdn.microsoft.com/.../dn531009.aspx.
Business Applications communities