Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

ID3242: The security token could not be authenticated or authorized

Posted on by Microsoft Employee

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:

01641.Untitled.png

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.


*This post is locked for comments

  • Nishant Rana Profile Picture
    Nishant Rana 55 Microsoft Employee on at
    RE: ID3242: The security token could not be authenticated or authorized

    Well in our case it was a different reason

    nishantrana.me/.../

    Just check how the ADFS / IFD is configured.

  • gagahlot Profile Picture
    gagahlot on at
    RE: ID3242: The security token could not be authenticated or authorized

    Hey kghareeb,

    How did u resolve it?

  • kghareeb Profile Picture
    kghareeb 5 on at
    RE: ID3242: The security token could not be authenticated or authorized

    Hi Simon,

    I am facing similar issue, were you able to fix yours

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: ID3242: The security token could not be authenticated or authorized

    I tried already like that, username as : Test2.CRM@ipsdubai.com but it does not worked. Throws the above error.

    Next Monday, will try it just the username without the domain: Test2.CRM

  • minohimself Profile Picture
    minohimself 2 on at
    RE: ID3242: The security token could not be authenticated or authorized

    Yes try it like that, try it also without domain

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: ID3242: The security token could not be authenticated or authorized

    The username is like an email: Test2.CRM@ipsdubai.com

    So you mean like this: ipsdubai.com/Test2.CRM@ipsdubai.com  ?

    Thanks

  • minohimself Profile Picture
    minohimself 2 on at
    RE: ID3242: The security token could not be authenticated or authorized

    Try to put @domain to your username ;)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans