Windows Server Posted January 23 Posted January 23 Hello everyone,Im sorry to post this again, but was pending for approve, but than suddenly vanished, without decline, delete or any feedback at all? What am i doing wrong? I Hope this one gets published I'm trying to connect my SPFx web part to the Microsoft Graph API in the most modern and seamless way possible, avoiding any additional login prompts for the user. Here's the setup I'm currently using:_graph = graphfi().using(graphSPFx(context as ISPFXContext));It's crucial for me to retrieve all the Graph API credentials directly from the SharePoint context to ensure a seamless experience for users. However, I'm encountering a 400 error when trying to acquire the token:AADSTS500011: The resource principal named 806f609a-6160-4235-ab06-91c8fe86ccee was not found in the tenant named ***. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant...The issue here is that the clientId mentioned (806f609a-6160-4235-ab06-91c8fe86ccee) does not exist in our tenant's Azure AD, and it never has. From my research, this seems like some kind of fallback client ID from Microsoft.The only way I can get it to work is by explicitly adding the correct clientId manually like this:_graph = graphfi().using(graphSPFx(context as ISPFXContext)).using(MSAL({ authParams: { scopes: [...] }, configuration: { auth: { clientId: "CORRECT_CLIENT_ID", // works when hardcoded authority: "https://login.microsoftonline.com/{tenantId}" }, cache: {...} }}));However, this approach causes a redirect or popup prompt, often requiring users to use multi-factor authentication on their mobile devices. My goal is to avoid this entirely.Questions:1. How can I retrieve the correct clientId directly from the SharePoint context? The context itself doesn't seem to expose what client ID is being used to authenticate to the Graph API.2. Is there any way to handle this without modifying the context or forcing a re-login?3. Why does SharePoint seem to be using this "mysterious" fallback client ID that doesn't exist in the tenant? I've looked at multiple tutorials, but most of them are outdated by several years (some over 8 years old). Even following those tutorials results in the same error when testing in the Workbench or after deployment.Does anyone know a way to address this issue without combing through outdated documentation? I’d appreciate any guidance or insights!Thank you in advance!Best regards,[Your Name]View the full article Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.