Blog Home  Home Feed your aggregator (RSS 2.0)  
Mayur's Blog - CRM Dynamics Error: The authentication endpoint Username was not found on the configured Secure Token Service” Error When Registering
 
# Thursday, May 14, 2015

Recently I was working on CRM Dynamics migration where the system was upgraded to the latest version for CRM Dynamics Online. CRM should be using claims based authentication as I was trying to authenticate against my Office 365 account.

I had latest 2015 SDK and trying to utilize early bound approach to integrate in-house applications to CRM Dynamics Online.

Things were okay until I found that the application was throwing an error while saving the context. Ironically, the application was able to generate service proxy with provided Id and Password. It was failing only when I tried saving the context.

I started looking around in SDK where there are many samples given. I figured that unless I specify correct Device credentials the system continued rejecting the request due authentication error mentioned above.

I put in the following code to generate proxy by referring SDK

  IServiceManagement<IOrganizationService> orgServiceManagement =

                        ServiceConfigurationFactory.

                        CreateManagement<IOrganizationService>(crmConnection.ServiceUri);

                    var clientCredentials = crmConnection.ClientCredentials;

                    var authCredentials = new AuthenticationCredentials();

                    authCredentials.ClientCredentials = clientCredentials;

                    authCredentials.SupportingCredentials = new AuthenticationCredentials();

                    authCredentials.SupportingCredentials.ClientCredentials = Microsoft.Crm.Services.Utility.DeviceIdManager.LoadOrRegisterDevice();                   

                    AuthenticationCredentials tokenCredentials = orgServiceManagement.Authenticate(authCredentials);

                    var organizationTokenResponse =

                        tokenCredentials.SecurityTokenResponse;

 

                    return proxy = new OrganizationServiceProxy(orgServiceManagement, organizationTokenResponse); 

It should be noted that this code base should use the connection string specified in "developer resource" tab available when you log in to your CRM account.

If you have set up something similar mentioned above and facing similar issues then you should try using device credentials.

Thursday, May 14, 2015 9:23:34 PM UTC  #       | 
Copyright © 2022 Mayur Bharodia. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.
Pick a theme: