Slack authentication
The Slack provider is not enabled yet. Only Google is live right now — calling auth.signIn() with this provider throws AuthErrorCode.PROVIDER_NOT_ENABLED. The page below documents its intended shape for when it is re-enabled. See the provider overview and the Google provider.
The Slack provider signs users in with a manual OAuth authorization-code flow protected by S256 PKCE. After the code exchange it fetches the real profile from Slack's OpenID Connect openid.connect.userInfo endpoint.
When you need a backend
A backend is optional. The PKCE-protected code flow can complete in the browser. If your Slack app configuration requires a client secret for the token exchange, keep that secret on a server — do not embed clientSecret in the browser bundle.
Configuration
import { auth } from 'capacitor-auth-manager';
auth.configure({
providers: {
slack: {
clientId: 'YOUR_SLACK_CLIENT_ID',
redirectUri: 'https://your-app.com/auth/slack/callback',
scopes: ['openid', 'profile', 'email'],
teamId: 'OPTIONAL_TEAM_ID',
},
},
});
Options
From the SlackAuthOptions interface in src/definitions.ts:
| Option | Type | Required | Purpose |
|---|---|---|---|
clientId | string | Yes | Slack app client ID. |
redirectUri | string | Yes | Redirect URI registered with the Slack app. |
clientSecret | string | No | Server-side only — keep out of the browser bundle. |
scopes | string[] | No | OpenID Connect scopes to request (e.g. openid, profile, email). |
teamId | string | No | Restrict sign-in to a specific Slack workspace. |
state | string | No | CSRF state value. |
nonce | string | No | OIDC nonce. |
Sign in
await auth.signIn('slack');
Notes & caveats
- The flow uses S256 PKCE (
code_challenge_method=S256) generated by the library. - The profile is fetched from
https://slack.com/api/openid.connect.userInfo; a network failure there surfaces as a clear error. teamIdlimits sign-in to one workspace; omit it to allow any workspace the app is installed in.- The library does not verify ID-token signatures in the browser — re-validate server-side if you trust the claims.