B2B Saas Authentication

/

API reference

/

OAuth

/

Organization

/

Login with Slack

Start Slack OAuth flow

GEThttps://test.stytch.com/v1/b2b/public/oauth/slack/start

A client-side endpoint (which can only be queried from the user's browser) that starts the Slack OAuth flow. This endpoint generates the Slack OAuth URL with all required fields and redirects the user to that URL. The user authenticates with Slack before getting redirected back to Stytch. After verifying the request, Stytch redirects the user back to the login_redirect_url or signup_redirect_url URL provided.

One of organization_id or slug is required to specify which organization the user is trying to access. If the organization that the user is trying to access is not yet known, use the Slack OAuth Discovery endpoint instead.

Scopes

By default our Slack OAuth integration requests the users:read and users:read.email scopes. Scopes requested are of the user_scope type. You may add any additional Slack API scopes (see here for a complete list) as a space separated list in the custom_scopes query parameter.

Additional provider parameters

Any parameters that should be forwarded to the OAuth provider can be passed as query parameters with the provider_ prefix. For example, Slack supports a team parameter that allows you to pre-populate the OAuth login flow with a suggested email address. To specify the team parameter in your OAuth request, you'd include provider_team=exampleHint as a query parameter. We recommend consulting each OAuth provider's documentation for a list of supported parameters.

Next steps

Once the user successfully authenticates with Slack, they'll be redirected to the redirect URL that you provided at the start of the OAuth flow with a Stytch OAuth token. Collect the token from the URL query parameters, and call Authenticate OAuth Token to complete authentication. The OAuth 2.0 Access Token and ID token will also be made available via the Get Slack Access Token endpoint.


Query parameters


public_token*string

organization_idstring

slugstring

login_redirect_urlstring

signup_redirect_urlstring

custom_scopesstring

provider_[parameter]string

pkce_code_challengestring

Response fields


status_codeint

request_idstring

redirect_urlstring
curl --request GET \
    --url 'https://test.stytch.com/v1/b2b/public/oauth/slack/start?public_token=PUBLIC_TOKEN&organization_id=organization-test-07971b06-ac8b-4cdb-9c15-63b17e653931'

RESPONSE

307
{
    "status_code": 307,
    "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
    "redirect_url": "https://slack.com/o/oauth2/v2/authorize?access_type=offline&client_id=example-client-id&redirect_uri=https%3A%2F%2Fstytch.com%2Fv1%2Foauth%2Foauth-callback-test-d868b16b-3ecd-49ac-7fc6-e3d1051c5d65&response_type=code&access_type=offline&state=example-state&user_scope=users%3Aread+users%3Aread.email",
}