Repository navigation
feat(standardized-auth): add an acme sample for standardized app auth - #305
Open
WilliamBergamin wants to merge 27 commits into
Open
WilliamBergamin wants to merge 27 commits into
WilliamBergamin wants to merge 27 commits into
Conversation
Connects user accounts with the Slack-owned Connect and Manage connection controls. Bolt's installation store holds each connection: the OAuth success hook reports it with apps.user.connection.requestAuth, the disconnect action forgets and revokes the user token, tokens_revoked forgets users who remove the app, and the user_connection_status_requested event is answered with apps.user.connection.update. App Home renders the auth_provider block. The user_connection request listener is written and tested but not yet registered, since no Bolt routes that payload to action listeners yet.
Resolves the conflict with #306, which replaced test.yml with ci.yml. Adds standardized-auth to the lint, typecheck, and test matrices. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
OAuth state no longer needs files on disk. The state is now an HMAC-signed token checked with the signing secret, and it expires after 5 minutes because a stateless token can be replayed until then. Installations stay in the file store so connections survive a restart. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
… helpers
Split the listeners into src/listeners/{events,actions,oauth}/, one file per
handler, following the bolt-python-starter-template layout. Replace the
AcmeAccounts and AcmeListeners classes, the Connection dataclass, and the
action ID constants with plain functions in src/acme.py, and use a single
App Home greeting. Tests mirror the new layout.
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Each listener file now registers itself with @app.action or @app.event, so its id sits next to its callback. app.py imports every file under src/listeners at startup, replacing the hand-written register functions, and the user_connection listener is registered too. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
… bolt_app.py Renaming src/app.py to src/bolt_app.py leaves one module named app, the entry point. The OAuth success and failure callbacks are arguments to OAuthSettings rather than listeners, so they now live next to the App they configure, and src/listeners holds only self-registering listeners. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Loading the listener directory where the app is built means any import of the app comes with every listener registered, and app.py is left as a plain entry point. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
…package The loader builds each module name from the listeners directory and the package bolt_app.py lives in, so no project root path is needed. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Walking the listeners package by module name reads more plainly than building names from file paths. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
…tion on forget Deleting only the per-user installer files left the revoked user token in the workspace's latest installation. Bolt's authorize then ran auth.test on that token for the disconnected user and dropped their next request. Saving the installation without the user token updates both files. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
The default success page sends org-wide installs to the admin page for adding workspaces. A user who clicked Connect should land back in the app's Home tab, so the success callback now redirects there. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
…in page The installation store pulled in OAuth, request URLs, a signing secret, token revocation, and tokens_revoked, none of which the sample is about. Acme now runs over Socket Mode, keeps connections in SQLite, and serves a small sign-in page as the Connect auth_url. A signed state ties that page to the Slack user who clicked Connect. Only the sign-in page needs ngrok, since auth_url must be HTTPS. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
…ample Sign-in state now comes from StatelessOAuthStateStore, signed with a per-user secret so the user_id tag can't be swapped, and expires after 5 minutes as the SDK docs recommend. Connections persist with shelve instead of a hand-written SQLite table, the sign-in GET only renders the form (the POST checks the state), and the Bolt dispatch tests that duplicated the listener tests are gone. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Clicking Connect now connects the Slack user who clicked it, with their user ID as the connected identity. Slack signs that click, so the sample no longer needs a browser sign-in page, a state, or a public URL; everything runs over Socket Mode. The manifest keeps example.com in auth_hosts because Slack requires at least one host when user connections are enabled. The README explains how to bring back auth_url with a signed state for a real login, and notes that the Slack CLI must be newer than v4.10.0 to send user_connections. Tests use setup_method/teardown_method in place of fixtures. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
The app and its five listeners now live in src/listeners.py, which drops the walk_packages loader in src/bolt_app.py and the listeners package tree. Listener tests move into tests/test_listeners.py. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
The App, its five listeners, and the Socket Mode entry point now share app.py, so src/listeners.py goes away. Listener tests follow as tests/test_app.py. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
…th_provider action ids Connect and Manage on the app profile now send the Events API user_connection event instead of an interaction payload, so the listener moves to app.event and reads subtype, trigger_id, and the bare user ID from the event. Only connect is answered, since Disconnect arrives as a block action. The auth_provider buttons now use the fixed auth_provider_connect and auth_provider_disconnect action ids, and the manifest subscribes to user_connection. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
The data folder is now made when Connections is built, so each method opens the shelf directly and the _open helper goes away. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
The connect and disconnect listeners now make their requestAuth and views_publish calls in app.py, so a reader sees each Slack API call where it happens. Connections become three shelve functions instead of a class with a module singleton and a data folder. src/acme.py keeps only the provider object, written as literal plain_text JSON, and the App Home view. Tests share one setup per file, patch the store's filename, stub auth.test without a fake response, and assert what each listener sends rather than rebuilding it with the code under test. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Every auth_provider button sends the same auth_provider_connect or auth_provider_disconnect action_id, and the provider's value is the only field in the payload that names the provider. The connect and disconnect listeners now acknowledge every click but act only when that value matches the one Acme sets on its provider. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Drop background_color and messages_tab_enabled, which no other sample sets. Keep users:read: the sample calls no scoped method, but App Home requires at least one bot scope (requires_a_bot_scope). Ignore the mypy, pytest, and ruff caches like the other top-level samples. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
WilliamBergamin
added a commit
to slack-samples/bolt-js-examples
that referenced
this pull request
Oct 21, 2026
Match slack-samples/bolt-python-examples#305: run over Socket Mode, keep connections in a local JSON file, handle the user_connection event and the fixed auth_provider_connect and auth_provider_disconnect action IDs, and answer user_connection_status_requested. The OAuth flow, installation store, tokens_revoked, and token revocation are gone. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
WilliamBergamin
added a commit
to slack-samples/bolt-java-examples
that referenced
this pull request
Oct 21, 2026
Match slack-samples/bolt-python-examples#305: run over Socket Mode, keep connections in a local properties file, handle the user_connection event and the fixed auth_provider_connect and auth_provider_disconnect action IDs, and answer user_connection_status_requested. The OAuth flow, installation service, tokens_revoked, and token revocation are gone. The SDK has no user_connection event model yet, so the sample defines UserConnectionEvent with a null default subtype to match Bolt's routing key. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
The sample needs requestAuth and the auth_provider block, which ship in the next slack_sdk minor. CI fails to install until 3.46.0 is published. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
WilliamBergamin
marked this pull request as ready for review
October 23, 2026 16:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This pull request adds a
standardized-authsample: Acme, an app that lets users connect their account with Slack's built-in Connect and Manage connection controls. Rocket skates, anvils, and giant magnets not included.shelvefile.Before merging
Needs
slack_sdk3.46.0to be released. The sample's CI job fails until then.Testing
Use a workspace with standardized app authentication and Slack CLI v4.11.0 or newer.
slack runinstandardized-auth.🤖 Generated with Claude Code