Provider – Slack

Slack Sample

Table of contents

How to enable Slack login in WordPress

1. Create a Slack App

To be able to log in via Slack you must create a Slack app first.

  1. Visit the Slack Sign In page and log in with your Slack credentials if you are not logged in, yet.
  2. Navigate to https://api.slack.com/apps
  3. Click the “Create New App” button. (If you can not see this button, you might need to create a workspace first!)
  4. Choose the “From scratch” option.
  5. Fill the “App Name” field, select your workspace and click the “Create App” button.
  6. Under the “Add features and functionality” panel click on the “Permissions” option.
  7. Add the URL to the “Redirect URLs” field, that Nextend Social Login suggests in the Getting Started section.
  8. Click on the “Save URLs” button.
  9. Scroll down to the “Scopes” section.
  10. Add the following Scopes to the “User Token Scopes” field: “openid”, “profile”, “email”
  11. On the top left side click on the “Basic Information” option in the “Settings”.
  12. Under the “Install your app” panel click on the “Install to Workspace” button.
  13. Click on the “Allow” button.
  14. Under the “Manage distribution” panel click on the “Distribute App” button.
  15. Scroll down to the “Remove Hard Coded Information” section.
  16. Click on the “I’ve reviewed and removed any hard-coded information.”.
  17. Click on the “Activate Public Distribution” button.
  18. On the top left side click on the “Basic Information” option, that you find under “Settings”.
  19. Scroll down to the “App Credentials” section, find the necessary “Client ID” and “Client Secret” values and fill these fields in the plugin settings!

2. App setup

Once your Slack app is ready you’ll need to copy and paste the Client ID and Client Secret values to the Slack provider’s Settings tab. You can find the information at your Slack app’s Basic Information tab.

3. Verifying

After the Client ID and Client Secret Value has been added you need to verify the setup first. This verification helps you identify possible problems with the app.

Settings

Slack Provider Configuration

Client ID

The Client ID of your Slack app. You can find it at your App’s Basic Information tab.

Client Secret

The Client Secret of your Slack app. You can find it at your App’s Basic Information tab.

Slack Team ID:

The Team ID of your Slack Workspace. You can find this ID in the URL of your Slack Workspace, while you are signed in to it. For example:
If you are currently signed in to the “Core” channel of the “Making WordPress” workspace, its URL will look something like this:

  • https://app.slack.com/client/T024MFP4J/C02RQBWTW

After the /client/ part you can find 2 identifies. The first identifier starting with T character is the Team ID:

  • T024MFP4J

and the second identifier starting with C character is the Channel ID:

  • C02RQBWTW

If you want to use our “Slack Team ID” setting, then you should enter the Team ID that you can find in the URL of your workspace.

Expected behavior when a valid Team ID is entered:

  • If the authenticating user is already signed in to the workspace with the given Team ID, then the authorization and authentication will happen with the associated workspace.
  • If the user is not signed in yet, then the user will be asked to specify a workspace to sign in to. The authorization and the authentication will happen with the specified workspace that the user entered, regardless of the Team ID that you entered into the Slack Team ID field.

Expected behavior when the Slack Team ID field was left empty:
The user will be able to enter the Slack URL of a workspace, or select a workspace if the person is already signed in to one. Then the authorization and authentication will happen with the selected workspace.

Slack Other Settings

Username prefix on Register

Whenever a new user registers with their Slack account they can get a custom prefix so you can easily identify them.

Fallback username prefix on register

Whenever a new user registers with their Slack account and we can not generate a valid username from the first name or last name, a random username will be generated. With this option they can get a custom prefix so you can easily identify them.

Terms and conditions

This option can only be seen, if Terms and conditions is set to Show in Global Settings → Privacy tab. Here you can set custom Terms and Conditions for users who register with Slack. For more information please read our GDPR documentation.

Profile image size

The avatar will be stored with the selected size.

Sync data

By default Nextend Social Login stores the first name, last name, email, avatar url and access token if it is possible, however some additional information can also be retrieved and stored.
When an option is checked, that field will be stored in a meta key with the specified name. The fields are stored in the wp_user_meta table.

Slack Sync data

Sync fields

It determines when the synchronization shall happen.

  • Register: whenever a new user registers with a provider, their data will be retrieved and stored.
  • Login: whenever user logs in with a provider, their data will be retrieved and stored.
  • Link: whenever user links and existing WordPress account with a provider, their data will be retrieved and stored.

Team ID

Stores the Team ID of the workspace the user connected with.

Locale

Stores the user’s locale.

Team Name

Stores the Team Name of the workspace the user connected with.

Team Domain

Stores the Team Domain of the workspace the user connected with.

Team Avatar URL (230px)

Stores the avatar url of the workspace the user connected with.

Is team avatar default?

Stores “Yes” value if the team avatar is the default team avatar.

Common error messages returned by Slack during verification

There’s been a glitch…

There’s been a glitch…
We’re not quite sure what went wrong. You can go back, or try looking on our Help Center if you need a hand.

The Client ID you copied from the Slack app is invalid. Make sure the correct one was copied.

redirect_uri did not match any configured URIs

Something went wrong when authorizing {{Your App Name}} with.
Try going back to NSL Sign In with and authorizing again. If problems persist, contact support for help.

Error details:
redirect_uri did not match any configured URIs.

Your Slack App doesn’t have the proper Redirect URLs added. Please check the Getting Started section of the Slack provider in Nextend Social Login, and add the suggested “Redirect URLs” value to your App!

Limitations

Workspace scoped user ID

Each workspace returns a different user ID for the same user. When a user connects with Slack, we will link this user ID to the WordPress account.
The problem is that, if the same user also tries to connect over another workspace, that workspace will return a completely different User ID, that won’t match with the one that we stored earlier.
On the other hand two completely different users can receive the same User ID in different workspaces.
For this reason we will create a unique User ID for the user by combining the Team ID with the User ID. This also means that, we won’t allow the login with other workspaces, just the one that the WordPress account was originally linked over.
Example:

  • A user registers over the workspace “example.slack.com”. The Team ID of this workspace is “T123” and in this workspace the user has the User ID: “U312”. From these values we will generate a unique User ID: “T123__U312” that identifies both the workspace and the user.
    The next time this user tries to login with this workspace, the person will be logged in to the WordPress account that this Slack account within the workspace has been linked to.
  • Suppose that, later this user tries to connect with another workspace “somethingelse.slack.com”. The Team ID of this workspace will be “T575”, and in this workspace the user receives the User ID “U973”. From these values we will generate a unique User ID: “T575__U973”. This User ID won’t match with the one that this user connected earlier, so we won’t allow the login with it.