web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Authenticate to CRM Online Web API without showing a login form to the user

(1) ShareShare
ReportReport
Posted on by

Hi Community,

I am trying to integrate a public web site with CRM Online 2016 : the goal is to create a new CRM Contact when a user inputs his personal data into a form on the public web site.

As I am integrating a public web site, visitors are not authenticated. Yet, the CRM Web API requires authentication.

I would like to define a CRM service user for the web site (say "WEBSITE") that would have its own password, and use this account to input data into CRM.

I read this link which describe various scenarios to authenticate and get a token usable for CRM Web API calls : https://azure.microsoft.com/en-us/documentation/articles/active-directory-authentication-scenarios/

All scenarios imply asking the web site users for a login/password, but these users are anonymous users, they don't have one.

Is there a way to get the web site to authenticate to use the CRM Web API without asking credentials from the web site visitor ?

*This post is locked for comments

I have the same question (0)
  • Joe Gill Profile Picture
    on at

    Hi Edouard,

    I would suggest that you create your own server side code to connect to CRM and you call call this from your web client.  so if you are were using MVC you could create a controller with a CreateLead method which would handle this and with the CRM connection details stored in the web.config.

    I hope this makes sense

    Joe

  • Community Member Profile Picture
    on at

    Hi Joe,

    Thank you for your answer.

    This does make sense. Actually, I am trying to do just what you are suggesting.

    The problem is when I look at the documentation provided by Microsoft on the CRM Web API, I can't seem to find an authentication method which would just let me authenticate by user/password and would return a token.

    It looks like I always have to input a password manually, and that is what I want to avoid.

    I would really appreciate it if you could point me to the documentation of a CRM web service that would give me an authentication token by inputing a user/password.

    Edouard

  • Suggested answer
    Joe Gill Profile Picture
    on at

    Hi Edouard,

    Here is an example that uses ASP.NET msdn.microsoft.com/.../gg695790(v=crm.7).aspx This uses early binding but you could use late binding if you prefer

    If you look at the sample code examples in the SDK you can see how to create a connection and create records

    Best of luck

    Joe

  • Community Member Profile Picture
    on at

    Hi Joe,

    This could work but I think it relies on the web site being able to use DLLs.

    I should have mentioned this earlier : my web site is based on Drupal. I don't think any PHP code could make use of these DLLs...

    That is why I was looking to this new way to do the same thing in CRM 2016 using this neat REST/JSON API : msdn.microsoft.com/.../gg328090.aspx

    It looks fairly simple, I would just have to send this JSON HTTP request to the right URL to create an account :

    POST https://xxxxxxx.crm4.dynamics.com/api/data/v8.0/accounts HTTP/1.1
    
    Content-Type: application/json; charset=utf-8
    OData-MaxVersion: 4.0
    OData-Version: 4.0
    Accept: application/json
    
    {
       "name": "Sample Account",
       "creditonhold": false,
       "address1_latitude": 47.639583,
       "description": "This is the description of the sample account",
       "revenue": 5000000,
       "accountcategorycode": 1
    }

    IF only I was authenticated prior to that :-)

  • Suggested answer
    Joe Gill Profile Picture
    on at

    Hi Edouard,

    I would you have a look at some of the sample code that Jason Lattimer has done I am am sure you will get some pointers  from it

    jlattimer.blogspot.ie/.../PHP

    An alternative would be to create a email queue in CRM and get you web site to email the  data to this queue. You could auto create a record on receipt of the email but may need to write some code to parse data from the email

    Cheers

    Joe

  • Community Member Profile Picture
    on at

    Thanks Joe, that set me on the right path !

  • Community Member Profile Picture
    on at

    Joe, 

    This is a soap messaging protocol, and the REST API 2016 are json odata protocol, so how to authenticate with the REST API if the api are protected with ADFS server?

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans