How to identify existing users after authenticating via Slack OAuth?

Multi tool use
How to identify existing users after authenticating via Slack OAuth?
I have an web application with existing users and user ids (i.e. not Slack user ids). I'd like to allow my users to install my new Slack app.
How do I know which of my users connects to Slack using OAuth and installs my app? I know you can request email but what if the Slack email is different from the email address used to originally sign up to my application.
It's crucial that I know which Slack users are linked to my existing users. Is there a way to send my existing users' user_id through the OAuth process so I know how to link a Slack user to one of my users?
Potential Solutions?
state
Sign in with Slack
Add to Slack
I’m using Add to Slack. Since my app has to behave differently for each workspace. I need to have something that anchors it to my existing users.
– Ryan
Jul 2 at 11:02
1 Answer
1
I would not use the state
property to transfer user information. It's theoretical possible, but would defy the purpose of the state property as security measure.
state
Instead you just need to keep the user context on your website during the Oauth process (e.g. by storing the user ID in a server session), so you can store the connection between your custom user ID and the Slack user ID later.
Here is the full process:
auth.test
users.profile.set
This helps. Thank you very much.
– Ryan
Jul 3 at 14:17
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Which of the two OAuth flows/buttons (
Sign in with Slack
orAdd to Slack
) are you using for your app integration?– Adil B
Jul 2 at 5:33