Share via

SharePoint Framework get data from on premise web api

Nilesh Kodulkar 1 Reputation point
2022-02-19T21:08:10.507+00:00

Hello All,

I know we can make calls to external/anonymous api from SPFX however I want to know what is the secure way of calling web api which is hosted in SP 2019 farm from SPFX webpart?

Regards,
NK

Microsoft 365 and Office | SharePoint Server | Development
0 comments No comments

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,496 Reputation points Microsoft External Staff
    2022-02-21T02:15:55.447+00:00

    Hi @Nilesh Kodulkar ,
    When building SharePoint Framework solutions, you might need to connect to an API secured by using Azure Active Directory (Azure AD). SharePoint Framework allows you to specify which Azure AD applications and permissions your solution requires, and a global or SharePoint administrator can grant the necessary permissions if they haven't yet been granted. By using the AadHttpClient, you can easily connect to APIs secured by using Azure AD without having to implement the OAuth flow yourself.
    Please refer to the following document to connect to Azure AD-secured APIs in SharePoint Framework solutions.

    https://learn.microsoft.com/en-us/sharepoint/dev/spfx/use-aadhttpclient


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.