Dynamics CRM C# Plugin Web Form - Authenticate with One Login SAML

579 views Asked by At

I have a client that just changed their Dynamics CRM login to use "One Login" (https://www.onelogin.com/product/sso), I believe with SAML. I was not part of this change. However a Web Leads Form that I built them that creates leads in CRM directly now does not work because it used the following to login in the Web.config of my aspx project.

<connectionStrings>
<add name="Xrm" connectionString="Server=https://***CLIENT***.crm.dynamics.com; Username=user; Password=pass" />
</connectionStrings>

//In the code behind
var xrm = new XrmServiceContext("Xrm");

It now gives this error

the authentication endpoint username was not found on the configured secure token service

Obviously they turned off Username/Password login on CRM.

I have no idea how to proceed next. My thought is that I need to somehow call a login to One Login to get a Token and then pass a token to CRM? Does anyone know how to do this in C# .net? What questions do I need to ask my client as it relates to what tokens, etc I need to get from One Login. I have never worked with them before.

Or at least the general idea of the concept of obtaining tokens and passing them back and forth. I believe this is SAML?

1

There are 1 answers

0
rlcrews On

I would check to see what type of claim is generated by the OneLogin application. Microsoft Dynamics uses two types of authentication. Active directory and OAuth2.

These link will point you to how Dynamics uses authentication

https://msdn.microsoft.com/en-us/library/gg328497.aspx

https://msdn.microsoft.com/en-us/library/dn531009.aspx

http://sharpshooting.github.io/authentication/2015/03/24/oauth2-on-dynamics-crm-online.html

As far as obtaining the claim (if it is Oauth) I would look to some of the existing libraries such as JWT https://jwt.io/ they have some straight forward libaries for c#,