Using JavaScript to Authenticate External APIs from Power Pages
Image Source: Shutterstock.com
Power Pages
Sep 23, 2023 11:00 AM

Using JavaScript to Authenticate External APIs from Power Pages

by HubSite 365 about Michel Mendes [MVP]

Microsoft MVP | Senior Consultant at Avanade | Microsoft 365 | Power Platform | SharePoint

External Blog Post
Citizen Developer

Power PagesLearning Selection

Optimize your Power Pages with secure API calls using OAuth 2.0 and JavaScript, courtesy of our Microsoft expert guide.

Michel Mendes [MVP], an expert in Microsoft technologies, shares an insightful breakdown on how to securely call external APIs using JavaScript from Power Pages. Mendes recommends the use of OAuth 2.0 implicit grant flow for Power Pages site, which provides you an authentication token for your Portal. This token can be effectively used for authenticated calls to external APIs, offering a good level of information security.

The author provides a step-by-step guide to use the token in JavaScript. This starts with enabling OAuth 2.0 implicit grant flow, obtaining a token by calling a given endpoint, and then using it for calling authenticated API. Mendes also shares a valuable JavaScript code sample to obtain the token.

This is followed by instructions on how to validate the token in destination API. He suggests different methods for token validation through API and Azure APIM for enhancing security.

Mendes wraps up the article by hoping that his post helps the readers in making secure authenticated calls for their Power Pages sites.

  • Enable OAuth 2.0 implicit flow for your site.
  • Obtain a token by calling the specified endpoint.
  • Use this token to call the authenticated API.
  • Validate the token in destination API.
  • Secure your token via Azure APIM.

Main Topics Discussed

In this article, Michel Mendes discusses secure external API calls using JavaScript from Power Pages. He suggests using OAuth 2.0 implicit grant flow to obtain authentication tokens. This system allows for secure calls, protecting information and application from hacking. A step-by-step guide details how to use tokens in JavaScript, including useful code samples. Mendes also talks about validating tokens at the destination API, offering different validation methods for different security levels.

Read the full article Call authenticated external APIs using JavaScript from Power Pages

Learn about Call authenticated external APIs using JavaScript from Power Pages

The text discusses how to call authenticated external APIs using JavaScript from Power Pages to keep the calls secure and avoid information exposure or application hacking. It mentions enabling OAuth 2.0 implicit grant flow on Power Pages sites, through which you can obtain an authentication token, and use it to make authenticated calls to external APIs. The text provides instructions on enabling OAuth 2.0 implicit flow in your site and how to use the token in JavaScript. Additionally, the token can be validated in the destination API for higher security or through Azure APIM directly for more usage restrictions.

More links on about Call authenticated external APIs using JavaScript from Power Pages

Configure external API Rest in power pages
Dec 18, 2022 — Solved: Hello everyone. We are designing a portal for a client using power pages. We have some external APIs by the client (they return PDF). We have.
PowerApps portals and external API integration
The simplest way to do so is to run Javascript as below: $.get("/_services/auth ... authenticated and authorized by a given instance of Power Apps portal. So ...
Calling an API in Power Apps Portals using JavaScript
Feb 1, 2021 — First, I selected Browse website to view my page. Once the page loaded, I confirmed the API was called and values were returned. Lastly, I ...
Query (HTTP GET) data in Power Apps Portal from Web ...
Oct 26, 2021 — Is it possible to use the GET endpoints or the second API altogether, authenticated as a Portal Contact user like the previous operations?
Power Pages: When to Use (and When Not To)
Mar 6, 2023 — Or you can use external APIs (like a companion app) to bring interact with other data via JavaScript on your site. But these are typically ...
michelcarlo - Microsoft 365, Power Platform and SharePoint ...
How to call an authenticated external API using JavaScript from a Power Pages site. Read Post · Using SharePoint list formatting and Power Automate to create ...
Dynamics 365 call custom api. So, in this blog, we will see ho
Dynamics 365 call custom api. So, in this blog, we will see how to use the same Custom API in a Power Automate Flow. Once the custom API is created, ...

Keywords

Microsoft expert guide, Microsoft professional advice, Microsoft Power Pages tutorial, Microsoft OAuth 2.0 implicit flow guide, Microsoft secure API calls tutorial