SPFx webpart in MSTeams Desktop Client throws an UnauthorizedAccessException

%3CLINGO-SUB%20id%3D%22lingo-sub-1149284%22%20slang%3D%22en-US%22%3ESPFx%20webpart%20in%20MSTeams%20Desktop%20Client%20throws%20an%20UnauthorizedAccessException%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1149284%22%20slang%3D%22en-US%22%3E%3CP%3EThis%20question%20is%20very%20similar%20to%20a%20question%20which%20has%20been%20asked%20previously%20on%20StackOverflow.%20However%2C%20the%20error%20I'm%20getting%20is%20different.%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fstackoverflow.com%2Fquestions%2F56073225%2Faadhttpclient-fails-when-loading-sp-page-with-spfx-webpart-in-msteams-desktop-cl%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAadHttpClient%20fails%20when%20loading%20SP%20page%20with%20SPFx%20webpart%20in%20MSTeams%20Desktop%20Client%3C%2FA%3E%3C%2FP%3E%3CP%3EI%20also%20have%20a%20Sharepoint%20Online%20site%20in%20which%20I%20have%20an%20SPfx%20web%20part%20that%20makes%20use%20of%20AadHttpClient.%20This%20web%20part%20works%20if%20I%20navigate%20to%20the%20Sharepoint%20site%20from%20a%20browser%20or%20open%20MS%20Teams%20web%20client.%3C%2FP%3E%3CP%3EMy%20setup%20is%20as%20follows%3A%3C%2FP%3E%3CUL%3E%3CLI%3EI%20have%20a%20team%20in%20MS%20Teams%3C%2FLI%3E%3CLI%3EI%20added%20a%20new%20tab%20in%20Teams%20and%20selected%20Sharepoint%20from%20available%20apps%3C%2FLI%3E%3CLI%3EI%20selected%20an%20existing%20Sharepoint%20site%20to%20be%20displayed%3C%2FLI%3E%3C%2FUL%3E%3CP%3EWhen%20I%20debugged%20the%20MS%20Teams%20desktop%20client%2C%20I%20have%20this%20call%20in%20in%20the%20Network%20requests%20tab%3A%3C%2FP%3E%3CBLOCKQUOTE%3E%3CP%3E%7B%22odata.error%22%3A%7B%22code%22%3A%22-2147024891%2C%20System.UnauthorizedAccessException%22%2C%22message%22%3A%7B%22lang%22%3A%22en-US%22%2C%22value%22%3A%22Access%20denied.%20You%20do%20not%20have%20permission%20to%20perform%20this%20action%20or%20access%20this%20resource.%22%7D%7D%7D%3C%2FP%3E%3C%2FBLOCKQUOTE%3E%3CP%3EI%20wonder%20why%20this%20only%20happens%20in%20MS%20Teams%20desktop%20client%20and%20not%20on%20either%20the%20web%20client%20on%20Sharepoint%20Online.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECross%20posted%20from%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fstackoverflow.com%2Fquestions%2F59860729%2Fspfx-webpart-in-msteams-desktop-client-throws-an-unauthorizedaccessexception%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fstackoverflow.com%2Fquestions%2F59860729%2Fspfx-webpart-in-msteams-desktop-client-throws-an-unauthorizedaccessexception%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1149284%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1149626%22%20slang%3D%22en-US%22%3ERe%3A%20SPFx%20webpart%20in%20MSTeams%20Desktop%20Client%20throws%20an%20UnauthorizedAccessException%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1149626%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F543955%22%20target%3D%22_blank%22%3E%40sahansera%3C%2FA%3E%26nbsp%3B%2C%20Please%20reach%20out%20to%26nbsp%3B%3CSPAN%3Emicrosoftteamsdev%40microsoft.com%20over%20Email%20and%20share%20the%20recording%20so%20we%20can%20look%20into%20the%20issue.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1151531%22%20slang%3D%22en-US%22%3ERe%3A%20SPFx%20webpart%20in%20MSTeams%20Desktop%20Client%20throws%20an%20UnauthorizedAccessException%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1151531%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F371090%22%20target%3D%22_blank%22%3E%40Trinetra-MSFT%3C%2FA%3E%26nbsp%3BThanks%20for%20your%20response.%20As%20discussed%2C%20I%20have%20emailed%20you%20the%20screen%20recording.%20Let%20me%20know%20if%20you%20need%20more%20info%20on%20the%20issue%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1188323%22%20slang%3D%22en-US%22%3ERe%3A%20SPFx%20webpart%20in%20MSTeams%20Desktop%20Client%20throws%20an%20UnauthorizedAccessException%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1188323%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F543955%22%20target%3D%22_blank%22%3E%40sahansera%3C%2FA%3E%26nbsp%3Bis%20this%20got%20resolved%20%3F%20if%20yes%20please%20post%20the%20steps.%20thanks%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

This question is very similar to a question which has been asked previously on StackOverflow. However, the error I'm getting is different.

AadHttpClient fails when loading SP page with SPFx webpart in MSTeams Desktop Client

I also have a Sharepoint Online site in which I have an SPfx web part that makes use of AadHttpClient. This web part works if I navigate to the Sharepoint site from a browser or open MS Teams web client.

My setup is as follows:

  • I have a team in MS Teams
  • I added a new tab in Teams and selected Sharepoint from available apps
  • I selected an existing Sharepoint site to be displayed

When I debugged the MS Teams desktop client, I have this call in in the Network requests tab:

{"odata.error":{"code":"-2147024891, System.UnauthorizedAccessException","message":{"lang":"en-US","value":"Access denied. You do not have permission to perform this action or access this resource."}}}

I wonder why this only happens in MS Teams desktop client and not on either the web client on Sharepoint Online.

 

Cross posted from: https://stackoverflow.com/questions/59860729/spfx-webpart-in-msteams-desktop-client-throws-an-unauth...

3 Replies
Highlighted

@sahansera , Please reach out to microsoftteamsdev@microsoft.com over Email and share the recording so we can look into the issue.

Highlighted

@Trinetra-MSFT Thanks for your response. As discussed, I have emailed you the screen recording. Let me know if you need more info on the issue

Highlighted

@sahansera is this got resolved ? if yes please post the steps. thanks