microsoft / CopilotStudioSamples

MIT License
291 stars 234 forks source link

Copilot is not loading on Mobile browser #228

Open gautam990 opened 1 month ago

gautam990 commented 1 month ago

What sample tool are you using? SharePoint SSO component

Describe the bug We have embedded the bot to SharePoint site and its working fine but when we open it in mobile copilot is loading indefinitely. Its not able to authenticate user .

To Reproduce Steps to reproduce the behavior:

  1. Go to Safari/Edge/Chrome browser and open the SharePoint site link where co-pilot is embedded
  2. Click on copilot button

ERROR contentSourceFilter is not supported on narrow screen devices LOG InteractionRequiredAuthError: no_tokens_found: No refresh token found in the cache. Please sign-in. LOG BrowserAuthError: monitor_window_timeout: Token acquisition in iframe failed due to timeout. For more visit: aka.ms/msaljs/browser-errors.

Expected behavior Co-pilot should be ready to use in mobile

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

gautam990 commented 1 month ago

any suggestion on this ?

adilei commented 1 month ago

I've had the component successfully load on Chrome on a mobile device. If your mobile browsers are configured to block third party cookies, it is possible that token acquisition using a hidden iframe is blocked.

To overcome this issue (assuming that this is indeed the underlying issue!), the component can acquire a token by redirecting the user to a login page. This will still support SSO but will have some detrimental impact on user experience.

You will have to amend the code yourself to support this, but here is where to start:

https://learn.microsoft.com/en-us/entra/identity-platform/reference-third-party-cookies-spas#performance-and-ux-implications

https://learn.microsoft.com/en-us/entra/identity-platform/scenario-spa-sign-in?tabs=react#sign-in-with-a-redirect