Given that web parts are granted authorization via OAuth Implicit flow, what exactly is the mechanism that establishes the trust relationship between the Azure AD secured Web API and SharePoint? Specifically, what configures the Web API's app registration to accept [my-tenant].sharepoint.com/etc/etc as a valid redirect URI? Is this done automatically when a SharePoint admin grants permission to the API, or are there other steps to be taken to establish the trust relationship?
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
@byronwjones said:
what exactly is the mechanism that establishes the trust relationship between the Azure AD secured Web API and SharePoint
Every SPO tenant has an Azure AD app that's created in your tenant the first time you grant a permission to SPO to the Azure AD app that protects your HTTPS endpoint. Both apps are in Azure AD so they share trust with Azure AD. When you grant SPO the permission to your HTTPS endpoint, you're effectively giving SPO permission to call it. SPFx is obtaining an access token from AAD for SPO. SPO then hands that token to your SPFx component which it uses to directly call your HTTPS endpoint. The first picture in the first section of this article shows how it works.
@byronwjones said:
Specifically, what configures the Web API's app registration to accept [my-tenant].sharepoint.com/etc/etc as a valid redirect URI?
The redirect URI is only used when you are authenticating with Azure AD... IOW: when you're logging in. There is no login with SPFx... you're already logged into SharePoint Online.
Closing this issue as "answered". If you encounter a similar issue(s), please open up a new issue. See our wiki for more details: Issue-List: Our approach to closed issues
Most helpful comment
@byronwjones said:
Every SPO tenant has an Azure AD app that's created in your tenant the first time you grant a permission to SPO to the Azure AD app that protects your HTTPS endpoint. Both apps are in Azure AD so they share trust with Azure AD. When you grant SPO the permission to your HTTPS endpoint, you're effectively giving SPO permission to call it. SPFx is obtaining an access token from AAD for SPO. SPO then hands that token to your SPFx component which it uses to directly call your HTTPS endpoint. The first picture in the first section of this article shows how it works.
@byronwjones said:
The redirect URI is only used when you are authenticating with Azure AD... IOW: when you're logging in. There is no login with SPFx... you're already logged into SharePoint Online.