Slack OAuth v2
Slack has a new OAuth v2 flow. Here are the major changes:
- Authorization URL has changed to
https://slack.com/oauth/v2/authorize - Authentication URL has changed to
https://slack.com/api/oauth.v2.access - You can now request bot and user scopes within same call by specifying
scopeanduser_scoperespectively. Most OAuth libraries allow you to only pass ascopeparameter. If however you want to request user scopes as well, find a way to pass the parameter in your library. If your library does not support custom request parameters, one hack would be to add it to the authorization URL:https://slack.com/oauth/v2/authorize?user_scope=identity.basic - If you are authenticating as a bot only, meaning you are only passing
scopeparameters, be sure your library is not using a profile URL that requires user scope/token. Most libraries usehttps://api.slack.com/methods/users.identityas the profile URL and that method requiresidentity.scopewhich is only available to user scopes (user_scope). You have two options. One is to add the user scopeidentity.scopeduring the auth request. The other option is to use a profile URL you can access with your bot token. An example of such isusers.info(requiresusers:readbot scope). - If you are looking for a Slack OAuth v2 library for Node, check out @kehers/passport-slack.