-1

So I am working on an electron app and I want to display MS Teams web app in it. I already managed to display MS Word, MS Powerpoint, and some other apps I want to display. Every app is working except MS Teams. I am using "window.loadURL('')" for all of them and all work except Teams. I have disabled nodeIntegration and enabled contextIsolation.

When I run the app and try to open Teams in the console there are 2 errors I can't resolve and I tried a lot of stuff to make it work.

Error Messages

enter image description here

Tell me if this is even possible I am not very experienced with electron...

Dev
  • 2,428
  • 2
  • 14
  • 15
  • Teams desktop client was developed using Electron and it uses Chromium for rendering. So why you want to reuse the app with electron? – Dev Jan 04 '21 at 13:57
  • I want it to be like a window inside my app so I can access it without having to run it as a separate app – Ivan Došlić Jan 04 '21 at 14:29
  • I never tried adding electron app inside another electron app, so i am not sure it will work and that too in the context of iFrame. If you find any info, please do share . – Dev Jan 04 '21 at 18:00

2 Answers2

1

The Teams Desktop Client is indeed built using Electron; however, we have written thousands of lines of Electron code and native modules to help us provide a near-native experience to our customers. Additionally, Teams uses a forked version of Electron that has numerous fixes for security vulnerabilities and other bugs that help keep our customers safe. The Web Client code you are trying to load via https://teams.microsoft.com makes assumptions about a number of IPC interfaces and other mechanisms provided by our Desktop Client code that wouldn't be available in your Electron app so it is unrealistic to expect it to just work.

Teams already provides a way to pull in content and tools from numerous Microsoft-built and partner applications that allow you to customize your client in any way you see fit. You can also build your own apps using our Platform (https://learn.microsoft.com/en-us/microsoftteams/platform/). Have you considered using these mechanisms to enhance the Teams Desktop Client instead of building your own alternative?

Yuri Dogandjiev
  • 178
  • 1
  • 8
  • 1
    Well I hope your going to submit a pull request for some of those changes you have made... give back... – Choco Feb 17 '21 at 04:50
0

Adding the latest chrome user agent to BrowserView helped. Before loading Teams in the BrowserView for Teams, you can add the latest chrome user agent to it.

const userAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36';
let view;
view = new BrowserView();
view.webContents.setUserAgent(userAgent);
view.wevContents.loadURL('https://teams.microsoft.com');

This is for Chrome 87 however if you try to set the user agent to just 'Chrome' you will get an error like "your browser version is too old".

The same goes for electrons BrowserWindow.

And yeah, it can be a solution. But I don't recommend using it. As Google is planning on making a lot of changes to the user agent and eventually removing it. More about it you can read here:

And yeah, maybe you could use it but we can't know how even slight changes from Google will affect your electron app.