SPFx web-part authentication with REST API not secured with AAD

testuser7 266 Reputation points


We know that SPFx web-part is client-side solution.
The practical implication of this term is, whichever APIs this web-part is dependent on, that API must be registered and secured with Azure-AD.
It could be MS-graph or any other API and SPFx has APIs like AadHttpClient and MSGraphClient to invoke it on behalf of the same user who has signed into SharePoint.

However, if my web-part wants to access some API which is a std. OAuth API but this API is NOT registered with AAD. Instead, it is registered with some other identity solution eg., Okta, Can such API be invokable by my web-part ??

If it was MS-teams custom app, teams provide java-script API to open up a modal-popup and let the custom app finish the full OAuth authentication flow with Okta.


A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,173 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jerryzy 10,556 Reputation points

    Hi @testuser7 ,

    You are welcome :)

    You could refer the following documentation to achieve authentication with Azure AD in SPFX Solution:

    Connect to Azure AD-secured APIs in SharePoint Framework solutions

    SPFx: Calling AAD secured Azure Function on behalf of a user with AadHttpClient

    And if the reply above is helpful to this question, I suggest you could accept as answer so that it could be helpful to others in the forum.

    Best Regards

    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. testuser7 266 Reputation points

    Thanks @Jerryzy-MSFT
    I can now at least stop thinking and designing in that direction.

    1 person found this answer helpful.
    0 comments No comments

  2. Jerryzy 10,556 Reputation points

    Hi @testuser7 ,

    Currently, SPFX is only available to autentcate with Azure AD, get access token and set related permission in Azure AD App, not supported other cloud platform.

    So other OAuth API can't be used in SPFX solution for authentication purpose.

    If an Answer is helpful, please click "Accept Answer" and upvote it.
    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.

    0 comments No comments

  3. testuser7 266 Reputation points

    Thanks @Jerryzy-MSFT

    The links that you sent me are great and I had followed it which put this question about third-party cloud identity platforms.

    Actually I have one point to discuss.
    As SPFx and Teams custom development is very comparable, there is one aspect of teams custom-tab which is really confusion me and I am still waiting for the answer.

    If you could eyeball https://learn.microsoft.com/en-us/answers/questions/106689/authentication-in-microsoft-teams-custom-apps-tabs.html, and clarify my doubt, that would be really helpful.


    0 comments No comments