Cannot retrieve Teams token from Side Panel

Copper Contributor

Hi, I'm trying to get the Teams Token in the in-meeting side-panel. Currently, I can get the Teams token in static tabs, but when I add the App in a meeting and I try to get the Teams Token I have the following error:

App resource defined in manifest and iframe origin do not match”. Currently, this only happens on localhost environment, but it is a recent error because a week ago we could retrieve the token as expected.

The way that I have to retrieve the Teams token in the code is: 

 

microsoftTeams.authentication.getAuthToken(authTokenRequest)

 

 

This information could be relevant:
In my package.json I have the following in validDomains:

 

"validDomains": ["{{HOST_NAME}}"]

 

 

Where HOST_NAME is a variable that has the value:

 

HOST_NAME=demo.localhost.localdomain:3021

 

 

And webApplicationInfo have the following

 

  "webApplicationInfo": {
    "id": "{{AZURE_APP_ID}}",
    "resource": "{{AZURE_APP_URI}}",
    "applicationPermissions": ["OnlineMeeting.ReadBasic.Chat"]
  }

 

 

Where AZURE_APP_ID is the same one that is in the App Registration of the Azure Portal.
And AZURE_APP_URI is like api://demo.localhost.localdomain/{{AZURE_APP_ID}}

 

ConfigurableTabs have the following:

 

  "configurableTabs": [
    {
      "configurationUrl": "https://{{HOST_NAME}}/side-panel-config",
      "canUpdateConfiguration": false,
      "scopes": ["groupchat"],
      "context": ["meetingSidePanel"]
    }
  ],

 

It works as expected in static tabs but it doesn't work in config tabs.

Thanks in advance,
best regards.

14 Replies

There are any updates please?

@rodrigolicata- We are looking into this I will get back to you soon.

@rodrigolicata - Please verify the contents of webApplicationInfo section:

"webApplicationInfo": {
    "id": "{AAD App client id}",
    "resource": "api://{Your tab app domain}/{AAD App client id}"
  }

Please make sure the domain in webApplicationInfo is same as your tab app's domain, otherwise Teams will return error.

@Sayali-MSFT

The content of webApplicationInfo section is the following: 

 

  "webApplicationInfo": {
    "id": "{{AZURE_APP_ID}}",
    "resource": "api://demo.localhost.localdomain/{{AZURE_APP_ID}}",
    "applicationPermissions": ["OnlineMeeting.ReadBasic.Chat"]
  }

 


The tab app's domain is: demo.localhost.localdomain:3021
The port is not included in the resource URL, but it's needed?

@rodrigolicata - Provide your Azure Active Directory App ID and Microsoft Graph information to help users seamlessly sign into your app. If your app is registered in Microsoft Azure Active Directory (Azure AD), you must provide the App ID. Administrators can easily review permissions and grant consent in Teams admin center.
Resource URL of app for acquiring auth token for SSO.
If you are not using SSO, ensure that you enter a dummy string value in this field to your app manifest, for example, https://notapplicable to avoid an error response.

@Sayali-MSFT Sorry, but this is not very helpful, you only pasted the same information from here . 

Yes. you need to add port in the resource URL.

@Sayali-MSFT  I tested the App with the following conditions:

  • Put the port only in the manifest: it brakes the App because I can't sign in.

  • Put the port only in Azure portal: the App works but I can't get the token from static tab (if I don't put the port in both sides I can get the token from static tab). There is an error.

  • And If I have it in both places I have the same error of having the port only in the manifest.

Could you please check the below thread hope it's helpful-
https://github.com/OfficeDev/TeamsFx/issues/2039?msclkid=fa862349cf8811ecb87368b5ecf8d19e

@rodrigolicata -Did you get the chance to check the above thread?

@Sayali-MSFT Thanks for the thread, I read it, but I didn't find a solution yet. The problem is that I can retrieve the Teams token from any static tab. But, the problem is only with the configurable tab and in localhost (in other environments works as expected), because in the configurable tab I cannot retrieve the Teams token because I have the mentioned error.

You can try out this Sample Code-Trinetra-MSFT/teams-tab-SSO-CSharp (github.com)

Thank you! I'll check with my current project if there are any difference in the configuration. Otherwise, I guess that I'll clone the project and configure it.
Now it works, the key was set the port in the manifest, in the audience of the token, and in Azure App URI to have the host with the port and now it works as expected. You can close this thread, thanks for all!