Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

How to authenticate when we call a external WEBAPI from html page in web resources.

Posted on by 25

I have a WEBAPI which is doing DB operations. This WEBAPI needs to be invoked from a HTML page in web resources in CRM. I am invoking the WEBAPI from HTML page using ajax. I need to do authentication for this call.

How can this be achieved?

*This post is locked for comments

  • Suggested answer
    RE: How to authenticate when we call a external WEBAPI from html page in web resources.

    Please refer the below link ..It's very good article which will help you to solve the WEBAPI problem.

    community.dynamics.com/.../ms-crm-2016-web-api-operations-retrieve-single-or-multiple-records

  • Suggested answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: How to authenticate when we call a external WEBAPI from html page in web resources.

    You need to retrieve a token, and then add the Authorization header to your request:

    req.setRequestHeader("Authorization", "Bearer " + token);

    If you are managing the credentials yourself, you can convert your credentials to Base64 on client side and re-convert them to string on api side.

    There are other options, all based on the sensitivity of your request, and what data source you are trying to connect with.

    You tags say CRM 2011, so it doesn't seem like you are using CRM Web Api, but your own custom webapi.

    Hope this helps.

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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans