Building Applications and Solutions with Microsoft 365 Core Services (legacy) — Question 19

You have a custom API that is secured by using Azure Active Directory (Azure AD).
You need to call the API from within a SharePoint Framework (SPFx) web part.
Which object should you use to call the API?

Answer options

Correct answer: B

Explanation

The correct answer is B: AadHttpClient, as it is specifically designed to authenticate requests to APIs secured by Azure AD. The other options, such as MSGraphClient and SPHttpClient, are tailored for different scenarios: MSGraphClient for Microsoft Graph API and SPHttpClient for SharePoint REST calls, while XMLHttpRequest does not handle Azure AD authentication natively.