0

We are facing an error while deploying a SharePoint application within the Microsoft Teams platform.

The application is built using the REACT (class components) + TypeScript + SPFX framework and is designed to display user-specific information such as meetings, calendar, and basic information.

We are required to call the graph API to fetch information, which requires an access token. To obtain this token, we are using "useMSAL" to get instance and accounts.

However, when we use "MsalAuthenticationTemplate interactionType={InteractionType.Redirect}," the following error occurs:

"Either Guest user or Cortex is not enabled!"

We have implemented the MSAL library for user authentication to use MS Graph APIs, and it works perfectly in SharePoint.

Still, it fails in MS Teams.

There are two methods for authenticating users, namely Popup & Redirect. If we use the Popup method, MS Teams shows that it cannot open the popup and may require an additional app.

If we use the redirect method, it does not redirect at all (only in MS Teams), and the user is not authenticated.

Can someone help us identify the root cause of this error and suggest possible solutions to fix it?

The exact error seen is as below :

sp-pages-assembly_en-us_70763d2ddd8945ddecd01003e22c52ba.js:70 Uncaught (in promise) Error: Either Guest user or Cortex is not enabled!     at new t (sp-pages-assembly_en-us_70763d2ddd8945ddecd01003e22c52ba.js:70:2196389)     at N (sp-pages-assembly_en-us_70763d2ddd8945ddecd01003e22c52ba.js:70:2196840)     at t._tryRenderAnnotations (sp-pages-assembly_en-us_70763d2ddd8945ddecd01003e22c52ba.js:70:2220209)     at a._handleCanvasViewportRendered (sp-pages-assembly_en-us_70763d2ddd8945ddecd01003e22c52ba.js:70:2199406)     at sp-pages-assembly_en-us_70763d2ddd8945ddecd01003e22c52ba.js:70:1489731     at Set.forEach ()     at e._handleViewPortRendered (sp-pages-assembly_en-us_70763d2ddd8945ddecd01003e22c52ba.js:70:1489707)     at e._tryLoadOutsideViewport (sp-pages-assembly_en-us_70763d2ddd8945ddecd01003e22c52ba.js:70:1489455)     at e._onComponentFinish (sp-pages-assembly_en-us_70763d2ddd8945ddecd01003e22c52ba.js:70:1486557)     at e.onAfterComponentRenderOrError

1 Answers1

0

I've been seeing this error on many SharePoint Sites while developing on them, and it never resulted in an issue on my side, I just thought it to be a temporary error on Microsoft's side.

Can you try and load your component in SharePoint or Teams Web, and maybe try to see where your component is not loaded ? Maybe explain which components are in your solution and what you expect should happen ?

Gostron
  • 255
  • 2
  • 6
  • Thanks for the response! So the expectation is that we have implemented MSAL library for user authentication for using MS Graph APIs. It works perfectly in sharepoint, but the same does not work in MS teams.  There are two methods for authenticating users, Popup & Redirect.  If we use Popup method, the MS teams shows that it cant open that popup and it may need an additiona app to do so.  If we use redirect method, it does not redirect at all (only in MS Teams) and user is not authenticated. – Lakshman Gupta Mar 15 '23 at 09:22
  • May I ask why you're not using the given objects by context (https://learn.microsoft.com/en-us/sharepoint/dev/spfx/use-aad-tutorial#consume-microsoft-graph) or full libraries like @pnp/graph for handling such cases ?. From a naïve standpoint, I'm really not surprised that Teams would not allow either opening popups or redirecting from your page/domain. – Gostron Mar 15 '23 at 11:27
  • @ gostron I have updated question with bit more details and can you please help us in letting know what could be the possible root cause there? – Lakshman Gupta Mar 16 '23 at 07:01
  • Still the same question as before, why are you not using the resources (link or library) from my previous comment ? It seems absolutely normal that you cannot redirect a Teams tab nor open a popup from within Teams. – Gostron Mar 16 '23 at 09:43
  • I tried using the graphClient method and for "https://graph.microsoft.com/v1.0/me/calendarView?startDateTime=2023-03-03T19:00:00-08:00&endDateTime=2023-03-03T19:00:00-08:00" , got an error like error : {code: "ErrorAccessDenied", message: "Access is denied. Check credentials and try again."} code : "ErrorAccessDenied" message : "Access is denied. Check credentials and try again." – Lakshman Gupta Mar 17 '23 at 09:51
  • @Ghostron Any suggestion on the above-mentioned error? – Lakshman Gupta Mar 21 '23 at 05:49
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Felix Quehl Mar 21 '23 at 10:44