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

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

Calling external Secured API Using Javascript

(0) ShareShare
ReportReport
Posted on by 10

Hello Experts,

Could someone please help me out with calling secured web api using javascript.

Scanirio: I need to call logic app from dynamics 365 using javascript but I am not very sure how to make that call.
 The logic app has been secured using App reg client id and secret.

I have the same question (0)
  • Suggested answer
    Abdul Wahab Profile Picture
    12,119 Moderator on at
    RE: Calling external Secured API Using Javascript

    Hi Rey D,

    I created a power automate with the trigger 'When a HTTP Request Received'

    pastedimage1663337432074v1.png

    and I call this flow using the below JS.

    var userSettings = Xrm.Utility.getGlobalContext().userSettings;
            var userId = userSettings.userId;
            var flowUrl = "https://prod-17.australiasoutheast.logic.azure.com:443/workflows/316d4acbd3a04c018ffa1485f1d09c3a/triggers/manual/paths/invoke?api-version=2016-06-01&sp=/triggers/manual/run&sv=1.0&sig=8IWx8Jw0Sk7F7IlxyWLbE3ciyUe5eR0YKwZMW_CtBS8";
            var input = JSON.stringify({
                "Account": accountId.replace("{", "").replace("}", "")
            });
            var req = new XMLHttpRequest();
            req.open("POST", flowUrl, true);
            req.setRequestHeader('Content-Type', 'application/json');
            req.send(input);

    So you would need something similar.

    If I answer your question then please mark it as verified.

    Let me know if I can provide you with more details.

    Thanks
    Regards,

    Abdul Wahab
    Power Platform/Customer Engagement Developer/Lead/Solution Architecture/Project Manager
    Direct/WhatsApp: 923323281237
    E-mail: abdulwahabubit@outlook.com
    Skype: abdul.wahabubit
    Linkedin: www.linkedin.com/.../

  • Rey D Profile Picture
    10 on at
    RE: Calling external Secured API Using Javascript

    Hey Abdul,

    Thanks for your effort and time in this.

    In the above example anyone from external world can call that API, Which I don't want in my case.

    Any suggestion for securing that Web API and calling using javascript ?

  • Suggested answer
    Abdul Wahab Profile Picture
    12,119 Moderator on at
    RE: Calling external Secured API Using Javascript

    Hi Rey D ,

    Is this something you are looking for: Authenticate to Microsoft Dataverse with the Web API (Dataverse) - Power Apps | Microsoft Docs?

    If I answer your question then please mark it as verified.

    Let me know if I can provide you with more details.

    Thanks
    Regards,

    Abdul Wahab
    Power Platform/Customer Engagement Developer/Lead/Solution Architecture/Project Manager
    Direct/WhatsApp:+923323281237
    E-mail: abdulwahabubit@outlook.com
    Skype: abdul.wahabubit
    Linkedin: www.linkedin.com/.../

  • Suggested answer
    Amit Katariya007 Profile Picture
    10,409 Super User 2025 Season 2 on at
    RE: Calling external Secured API Using Javascript

    Hello Rey,

    You probably will need Access token to run your web api.

    Once you will have the Access code then you will able to run your web api.

    Please refer below article which will help you to get access token first.

    xrmdynamicscrm.wordpress.com/.../

    Thank you,

    Amit katariya

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 228

#2
Tom_Gioielli Profile Picture

Tom_Gioielli 156 Super User 2025 Season 2

#3
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 149

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans