I am attempting to traverse up the site hierarchy tree using the Rest API in SharePoint with SPFx in order to create "legacy-style" breadcrumbs. I am basing my component on the code found here.
If the user does not have access to a particular site, I want to simply skip that site and not include it in that user's breadcrumb. The problem is, in an on-prem environment using NTLM-integrated security, the REST API automatically triggers a login dialog prompt when the currently-logged-in user does not have access. Since the current user does not have access, if they input their credentials, it keeps re-prompting them. The only way for the script to proceed, is if the user clicks "cancel", then we can handle the "Access Denied" case in code and continue building the breadcrumb.
How can we just receive an Access Denied message and avoid having the REST call trigger a credential popup when the user does not have permission?