ADO.NET Provider for Slack

Build 23.0.8839

Creating a Custom OAuth Application

CData embeds OAuth Application Credentials with CData branding that can be used when connecting to Slack via a desktop application or a headless machine. (For information on getting and setting the OAuthAccessToken and other configuration parameters, see the Desktop Authentication section of "Connecting to Slack".)

However, you must create a custom OAuth application to connect to Slack via the Web. And since custom OAuth applications seamlessly support all three commonly-used auth flows, you might want to create custom OAuth applications (use your own OAuth Application Credentials) for those auth flows anyway.

Custom OAuth applications are useful if you want to:

  • control branding of the authentication dialog;
  • control the redirect URI that the application redirects the user to after the user authenticates; or
  • customize the permissions that you are requesting from the user.

Procedure

To obtain the OAuth credentials OAuthClientId, OAuthClientSecret, and CallbackURL, you must create an OAuth application. This involves creating the application itself, setting a callback URL for the application, and configuring permission scopes.

Create the Application

Creating the OAuth application obtains two OAuth client credentials: OAuthClientId and OAuthClientSecret.

  1. Go to https://api.slack.com/apps.
  2. Specify a name and workspace for the application. The Client Id and Client Secret are listed in the App Credentials section, under Basic information.
  3. Record the Client Id and Client Secret for future use.

Set a Callback URL

After creating your application, define its CallbackURL:

  1. In your application settings, navigate to OAuth & Permissions.
  2. In the Redirect URLs section, click Add a New Redirect URL.
  3. Set the callback URL to http://127.0.0.1:33333, or another port of your choice.
  4. Record the URL.

Configure Permission Scopes

In order to use all possible features, you must specify the required scopes in the GetOAuthAuthorizationURL and GetOAuthAccessToken procedures, and within the application itself.

To configure the appropriate scopes within the OAuth application:

  1. In your app settings, navigate to OAuth & Permissions > Scopes.
  2. Navigate to Select Permission Scopes.
  3. Click the menu to add permissions by scope or API method.

Required Scopes:
channels:read, groups:read, im:read, mpim:read, channels:write, groups:write, im:write, mpim:write, channels:history, groups:history, im:history, mpim:history, search:read, chat:write:user, chat:write:bot, files:read, files:write:user, pins:read, pins:write, usergroups:read, usergroups:write, reminders:read, reminders:write, users:read, users.profile:write.

These values are all sent as default scopes in the GetOAuthAuthorizationURL and GetOAuthAccessToken procedures,

Distributing Your Custom OAuth Application

To make your OAuth application available to users in other workspaces, and enable them to install it:

  1. In your application settings (Settings section), click Manage Distribution.
  2. Complete the procedures to set a callback URL and configure permissions.
  3. Click Activate Public Distribution.

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 23.0.8839