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.