3

I have an app that connects with several platforms: Teams, Slack, Google etc.

I want to allow my users to add connections to their existing accounts: for example, if they are Slack only, allow them to connect teams into their same account on my platform.

For all other platforms, I can do this as follows:

  • Take the application URL (e.g. Slack)
  • Append a parameter state, with their ID on my platform e.g. SLACK_URL?state=${user.id}
  • When I then process the connection, the state parameter is supplied as part of the callback from the connected service, and I can identify the relevant user and connect to their account.

Is there a similar process for Teams? I've tried doing the same with the state parameter, and no dice, it doesn't seem to work

How the users connect:

  • Slack
    • We present a button that allows the user to authorise with Slack
    • In the URL of that button we set a parameter state with the users ID
    • When Slack is authorised, it calls back to our API, and passes that state value along
    • We then use that to identify the user account the new authorisation belongs to
  • Teams
    • We present a button that brings the user to the application install URL in the Teams app store
    • The user clicks that and goes through the installation process, adding the app to a channel of their choice

What we would like to do is the same as the Slack URL, set a state value with the users ID, and have that passed back to us on the initial installUpdate or membersAdded event from that channel.

Essentially what we'd like to do when connecting a users Teams account is set some metadata on the URL that they use to install the app, and have that sent back to us so we can identify the installing user.

This is common in OAuth flows, you set a state parameter with whatever you want, and that state is passed back on authorization.

michaeldever
  • 359
  • 4
  • 14
  • Could you please explain a bit more how you are connecting your app to different accounts e.g., slack, google? Which application are you using? Is it a web app? – Prasad-MSFT Jan 25 '23 at 09:16
  • @Prasad-MSFT I have added some more information on how we connect and how we'd like to receive some data back. – michaeldever Jan 25 '23 at 12:47
  • @michaeldever - Instead of doing this for app installation dialog, this needs to be done in your Tab page. When user visits the tab in a channel, you could show login prompt similar to other implementations and pass state in auth url. More Info here: https://learn.microsoft.com/en-us/microsoftteams/platform/tabs/how-to/authentication/auth-tab-aad?tabs=teamsjs-v2#navigate-to-the-authorization-page-from-your-pop-up-page – Wajeed Shaikh Feb 17 '23 at 08:49

0 Answers0