Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

ID3242: The security token could not be authenticated or authorized

$
0
0

Hi Guys,

I am trying to login to Microsoft Dynamics CRM 2015, as following:

public OrganizationServiceProxy ConnectToMsCrm(string UserName, string Password, string SoapOrgServiceUri)
{
try
{
ClientCredentials credentials = new ClientCredentials();
credentials.UserName.UserName = UserName;
credentials.UserName.Password = Password;
Uri serviceUri = new Uri(SoapOrgServiceUri);
OrganizationServiceProxy proxy = new OrganizationServiceProxy(serviceUri, null, credentials, null);
proxy.EnableProxyTypes();

return proxy;
}
catch (Exception ex)
{
LogHelper.Error(typeof(ConnectToMSCrmService), "Error while connectiong to CRM", ex);
return null;
}
}

var proxy = _connectToMsCrmService.ConnectToMsCrm("username", "password", "ipsdev.obeikan.com.sa/.../Organization.svc"); _organizationService = (IOrganizationService)proxy; Guid userid = ((WhoAmIResponse)_organizationService.Execute(new WhoAmIRequest())).UserId;

Now, when trying to execute, it is throwing the following error:

Then when trying to access  https://ipsdev.obeikan.com.sa/

and login with the same credentials, it will logs in.

Any help of guidance please?

Thank you in advance.



Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>