Skip to content

Slack support

First of all you need to have your API credentials ready by creating an app on Slack. Then add them to your para-application.conf configuration file:

para-application.conf
para.sl_app_id = "..."
para.sl_secret = "..."
para.security.signin_success = "http://success.url"
para.security.signin_failure = "http://failure.url"

Or add these through the app settings API:

{
"sl_app_id": "..."
"sl_secret": "..."
"signin_success": "http://success.url"
"signin_failure": "http://failure.url"
}

Para can return a short-lived ID token back to the client which initiated the request. Add jwt=id to your signin_success url. For example { "signin_success": "http://success.url?jwt=id" }. The id value of the parameter will be replaced with the actual JWT ID token, which you can use to call paraClient.signIn("passwordless", idToken) to get the long-lived session token.

Support for logging in with Slack accounts is implemented by the SlackAuthFilter. This filter responds to requests at /slack_auth.

The endpoint expects an appid value from the ‘state’ parameter, e.g. ?state={appid}. If that parameter is missing, the default (root) app will be used as authentication target.

To initiate a login with Slack just redirect the user to the Slack OAuth endpoint:

slack.com/oauth/authorize

Pass the parameter redirect_uri=/slack_auth?state=myapp so Para can handle the response from Slack.

Below is an example Javascript code for a Slack login button:

$("#slackLoginBtn").click(function() {
window.location = "https://slack.com/oauth/authorize?" +
"response_type=code&client_id={SLACK_APP_ID}" +
"&scope=identity.basic%20identity.email%20identity.team%20identity.avatar&state=" + APPID +
"&redirect_uri=" + window.location.origin + "/slack_auth;
return false;
});