How can I connect OAuth APIM from SharePoint hosted addin?

Anonymous
2021-12-13T06:55:25.977+00:00

I have created an APIM with OAuth. Using developer portal and Post man I can able to fetch the data from the APIM.
But I need to access that from my SharePoint Hosted Add-In?
How to generate token to get data from APIM? Plz suggest me on this.

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
1,959 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MughundhanRaveendran-MSFT 12,456 Reputation points
    2021-12-14T12:45:52.423+00:00

    @Anonymous ,

    Thanks for reaching out to Q&A.

    You can refer to the below articles that will guide you in connecting from Sharepoint hosted addin

    https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/authorization-and-authentication-of-sharepoint-add-ins

    https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/authorization-code-oauth-flow-for-sharepoint-add-ins

    You can also explore using MSAL js in SP addin
    https://learn.microsoft.com/en-us/azure/active-directory/develop/tutorial-v2-javascript-spa

    The sharepoint hosted addins are legacy and I would suggest using the SpFx : https://learn.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/guidance/connect-to-api-secured-with-aad

    I hope this helps!

    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.