Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bot-based message extension authentication with external browser #2304

Open
onmomo opened this issue May 3, 2024 · 5 comments
Open

Bot-based message extension authentication with external browser #2304

onmomo opened this issue May 3, 2024 · 5 comments
Assignees
Labels
teams issue issue that has been reviewed and likely teams specific teams-developer-support

Comments

@onmomo
Copy link

onmomo commented May 3, 2024

While implementing bot-based message authentication flow, we noticed that the authentication flow is triggered with the embedded browser of the Teams Desktop client. Using an embedded browser is not supported by Google anymore. It fails with "Error 403, disallowed_useragent" due to the authentication running in the embedded browser, which is a actually a security risk.

For our personal tab app, we implemented the authentication leveraging the isExternal: true flag, which resolves this issue for personal tab apps.

This is how we respond with our query and action message extensions to trigger the authentication flow in the embedded browser. We are following this guide for adding third party authentication to message extension.

return {
      type: 'auth',
      suggestedActions: {
        actions: [
          {
            type: 'openUrl',
            value: authUrl.toString(),
            title: i18next.t('card.auth.title', { lng: userLang })
          }
        ]
      }
    } as MessagingExtensionResult
Screenshot 2024-05-03 at 18 07 53

Please advise how we can trigger this flow on the external system browser in order to resolve this?

@Vikram-MSFT
Copy link

Thanks for raising your query, we will investigate it and get back to you.

@erinha erinha added the teams issue issue that has been reviewed and likely teams specific label May 7, 2024
@Vikram-MSFT
Copy link

Vikram-MSFT commented May 15, 2024

Hii @onmomo Could you please share repro steps or a short vedio for your issue and manifest to test it from our end?

@onmomo
Copy link
Author

onmomo commented May 15, 2024

@Vikram-MSFT Interestingly, I tried to reproduce the issue with Teams 2.0 on MacOS (Version 24091.213.2852.3731 (24091.213.2852.3731)) but I was not able to, seems resolved at least for MacOS. I don't really understand why this should have changed out of a sudden, though
I'm happy to share a video that reproduces the error on Teams for iOS. I already provided the sample code for the MessagingExtensionResult that initiates the shown auth flow.

google-auth-teams-ios.mov

Here are the resources google is referring to for the error disallowed-useragent

If you get an error that says “403 disallowed_useragent,” the app uses embedded WebViews. Some developers use WebViews to help display web content in an app. Embedded WebViews puts your security at risk because they could let third parties access and change communications between you and Google.

As far as we understand the issue, Teams for mobile should not leverage the embedded WebViews but open the native system browser instead to run the authentication flow with Google.

@Vikram-MSFT
Copy link

Hello @onmomo
Could you please try to use isExternal true in auth param.
Please refer this documentation:https://learn.microsoft.com/en-us/microsoftteams/platform/tabs/how-to/authentication/auth-oauth-provider

You can also refer this sample:https://github.com/OfficeDev/Microsoft-Teams-Samples/tree/main/samples/tab-external-auth/csharp

@onmomo
Copy link
Author

onmomo commented May 15, 2024

@Vikram-MSFT thanks for your response. As mentioned, I implemented isExternal for our personal tab and also contributed to the referenced docs, to allow a successful implementation of isExternal.
Unfortunately, isExternal seems not supported for bot based message extensions authentication flows. There isn't any call of the authentication() function at all in our code since this is happing by the teams clients when receiving a message of type "auth" it seems.
Could you please check with the developers if the msg extension auth docs are missing to describe "isExternal" support or if this is currently not supported at all? Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
teams issue issue that has been reviewed and likely teams specific teams-developer-support
Projects
None yet
Development

No branches or pull requests

4 participants