OfficeDev / microsoft-teams-emergency-operations-center

The Microsoft Teams Emergency Operations Center (TEOC) solution template leverages the power of the Microsoft 365 platform to centralize incident response, information sharing and field communications using powerful services like Microsoft Lists, SharePoint and more.
MIT License
90 stars 36 forks source link

Unable to Log in to TEOC #111

Closed SteveWedge closed 1 year ago

SteveWedge commented 1 year ago

Hi, Having successfully deployed the TEOC solution I'm now faced with a problem when trying to log on. I have attempted to log on with 2 different accounts, one being the account that I used to deploy the solution. With both accounts, after clicking on the Logon button, in the Teams TEOC App, I see a pop up window flash up and disappear, and then just see the Logon screen again.

I managed to capture the interim state, when the pop-up appears and this is shown below. This is obviously trying to connect to the App Service, that was created during deployment, but I don't see any activity when checking the logs for that service

image

I'm not sure what to check next, but I don't get prompted to grant permissions, although I have done this directly against the associated registered App. I am not seeing a Dashboard, so am clearly not getting logged on.

Please advise

v-prigunasek commented 1 year ago

Hi @SteveWedge ,

Can you please reproduce the issue again in browser version of teams and share me the console logs and the network trace (Har file) to further troubleshooting on this issue? Thanks!

SteveWedge commented 1 year ago

Here's the additional information you requested, as it happens I was already running this test in an InPrivate browsing session.

TeamsConsoleLogHar.zip

SteveWedge commented 1 year ago

It appears to be an issue related to "blocked by CORS policy: No 'Access-Control-Allow-Origin'"

v-prigunasek commented 1 year ago

Hi @SteveWedge,

I see from the trace, the clientId placeholder was not configured properly. Can you please check these steps under Set-up Authentication and make sure all the settings were configured correctly as mentioned in the wiki?

image

If everything seems to be correct here, please check the placeholders in the Teams Manifest file as well.

SteveWedge commented 1 year ago

Thanks, I'd missed the replacement of <> in the manifest for the Teams App. SO I've moved past that issue, I'm not getting a logon prompt at all now, but I don't see the dashboard and I'm still seeing a number of errors in the Console

image

From reviewing them I'm wondering if there is some (undocumented) configuration needed on the SharePoint site, like adding users to Role, creating roles, etc?

v-prigunasek commented 1 year ago

Hi @SteveWedge ,

I believe you have provisioned the SharePoint site for TEOC before deploying the solution in Azure. If yes, can you please check the REACT_APP_SHAREPOINT_SITE_NAME configuration in your app service ? (In Azure portal, navigate to TEOC resource group, open app service and click on Configuration) image

It should be just the site name (ex: KTBEmergencyResponders), if you have provided the full URL of the site by any chance, please update that to sitename as shown above and click ok and Save it.

Then perform this step, to get the code updated with the new site name value in your app service. Once that is done, open the app in teams and verify if that works as expected.

SteveWedge commented 1 year ago

Does the value need to correspond with the last part of the URL for the Site?

See below, the value from the configuration of the App Service: image

And here is the SharePoint site

image

Is there any dependency on the Site Title / Display Name matching? I did amend it to be a more friendly name, but have changed it back and still have no joy.

v-prigunasek commented 1 year ago

Thanks for sharing. There is no dependency for displayname and for the name in the URL, both can be different, but we should use the sitename from the URL in the App service configuration. If you have already provided "KTB-Emergency-Responders" in the configuration while deploying resources, then it should be correct. Can you please launch the app once to replicate the issue and share me the console logs and network trace to troubleshoot on the error messages? Thanks!

SteveWedge commented 1 year ago

TeamsConsoleLog.txt TeamsConsoleLogHar.zip

As requested and thanks for your assistance.

v-prigunasek commented 1 year ago

Hi @SteveWedge ,

I see there is some extra characters %E2%80%8E in the site name that is causing the error. (sometimes that might happen when we copy/paste the text) GET https://graph.microsoft.com/v1.0/sites/yourtenant.sharepoint.com:/sites/%E2%80%8EKTB-Emergency-Responders%E2%80%8E?$select=id 404 (Not Found)

Can you please update the SharePoint Site Name in the configuration to KTB-Emergency-Responders , click OK and Save it.

Then perform this step, to get the code updated with the new site name value in your app service. Once that is done, open the app in teams and verify if that works as expected.

SteveWedge commented 1 year ago

Can I confirm that you mean the REACT_APP_SHAREPOINT_SITE_NAME configuration in the app service, and not another configuration item? If so, then that is already equal to just the value of the site name (URL suffix), as I shared earlier. So I'm not clear where the mistake is.

%E2%80 is the ASCII encoding ref from UTF-8 for > %8E is the ASCII encoding ref from UTF-8 for Ž

v-prigunasek commented 1 year ago

Yes, I meant the REACT_APP_SHAREPOINT_SITE_NAME configuration only. Please clear out that field entirely once and type in the value KTB-Emergency-Responders and click OK and Save button. Then perform the Sync latest version step, to get the code updated with the new site name value in your app service.

SteveWedge commented 1 year ago

OK, I did exactly what you requested. I redeployed the service and then went back to Teams and refreshed the page. Unfortunately I still get the same outcome and I can see in the log that the request URL still has those invalid characters around the site name.

Request URL: https://graph.microsoft.com/v1.0/sites/kontoorbrands.sharepoint.com:/sites/%E2%80%8EKTB-Emergency-Responders%E2%80%8E?$select=id Request Method: GET Status Code: 404 Not Found Remote Address: 20.190.151.160:443 Referrer Policy: strict-origin-when-cross-origin

v-prigunasek commented 1 year ago

Okay, can you try clearing the browser cache and launch the TEOC app to see whether that works? If you still see any issues, can you check the following - In Azure portal, navigate to TEOC resource group, open app service and click on Advanced Tools, click on Go and then click on App Settings.

image

image

Check for the REACT_APP_SHAREPOINT_SITE_NAME variable and see if that has correct site name without any special characters.

image

SteveWedge commented 1 year ago

Closing & reopening the inPrivate Browser session seems to have resolved the issue, so clearly there was cached content causing the problem to appear to be present still.

It looks like its all up and running, many thanks for your assistance!

v-prigunasek commented 1 year ago

That sounds great! Thanks!!

Here is the summary of the issue: User was unable to login initially and we noticed that the clientId placeholder was not configured in the Manifest file. Corrected the same and then able to login to the app but received an error while connecting to SharePoint site due to some special characters in the REACT_APP_SHAREPOINT_SITE_NAME variable. Updated that environment variable with correct value and redeployed the app service, then logged in to the app again after clearing the browser cache and it was working as expected.