AXForum  
Go Back   AXForum > Microsoft Dynamics CRM > Dynamics CRM: Blogs
All
Forgotten Your Password?
Register Forum Rules FAQ Members List Today's Posts Search

 
 
Thread Tools Search this Thread Display Modes
Old 30.07.2019, 18:12   #1  
Blog bot is offline
Blog bot
Участник
 
25,646 / 848 (80) +++++++
Join Date: 28.10.2006
crmtipoftheday: Tip #1286: Synchronize your watches
Источник: https://crmtipoftheday.com/1286/sync...-your-watches/
==============

&tl;dr

If you’re using CrmServiceClient and getting what seems to be a valid connection but cannot really use it because of the “The user authentication failed!” error, check the servers’ clocks in your infrastructure.

Bo-o-o-oring

I have some perfect reasonable code deployed in Azure and that code has been humming along, talking to Dynamics 365 On-Premises for as long as I can remember. The code uses Xrm Tooling (yes, from time to time we listen to our own advice). Then one day – kabrakeeboom! – we get the log full of the following messages

Message: The user authentication failed!
StackTrace: at Microsoft.Xrm.Tooling.Connector
.CrmServiceClient.Execute(OrganizationRequest request)
blah-blah, our code
Quick check with the customer’s technical support – nothing has changed, no updates were installed on any of the servers. Sample code to troubleshoot:

string cs = "bleugh";using (var client = new CrmServiceClient(cs)) { if (client.IsReady) { Trace.WriteLine($"{client.GetMyCrmUserId()}"); var foo = client.Execute(new WhoAmIRequest()) as WhoAmIResponse; Trace.WriteLine($"{foo.UserId}"); }}Here’s the kick: IsReady is true and GetMyCrmUserId returns a valid value (probably cached) but Execute spits out “The user authentication failed”. Adding logging showed that coveted token gets invalidated immediately after the connection is made. It gets better: XrmToolBox would successfully connect to the instance as well but any attempt to use anything pops up “The user authentication failed!”


I’ll spare you the pain of ADFS debugging.

You know how they always synchronize watches in the action movies (there is even a song about it)? Now I know the reason.



ADFS server had its clock synchronized with the time service that was drifting over the time. Into the future. Once the drift was over 2 minutes, ADFS continued to issue tokens but they now were invalid the moment they left the server. Why nobody noticed and UI didn’t break? Because Dynamics 365 server was drifting as well, perfectly in sync with ADFS.



Источник: https://crmtipoftheday.com/1286/sync...-your-watches/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Similar Threads
Thread Thread Starter Forum Replies Last Post
crmtipoftheday: Tip #1103: Chart styling cheat sheet Blog bot Dynamics CRM: Blogs 0 08.04.2018 03:03
crmtipoftheday: Tip #1095: Add percentage labels to pie charts Blog bot Dynamics CRM: Blogs 0 02.04.2018 04:16
crmtipoftheday: Tip #1060: Quickly create vector/SVG images for Dynamics 365 Blog bot Dynamics CRM: Blogs 0 24.01.2018 22:11
crmtipoftheday: Tip #1007: What is the Common Data Service (CDS) today? Blog bot Dynamics CRM: Blogs 0 23.10.2017 19:12

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Рейтинг@Mail.ru
All times are GMT +3. The time now is 09:39.
Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Contacts E-mail, Advertising.