Connect accounts for published app users
Add per-user OAuth without exposing provider credentials to browser code
Published app-user mode lets every signed-in user connect their own provider account. Swarmz generates the server routes, stores encrypted provider tokens, and keeps each account isolated by project, connector, and app user.
Before you start
- The connector must support Published app user mode.
- A Swarmz or Platform administrator must enable the connector and configure its OAuth application.
- Your project needs sign-in. The server must be able to identify the current user from its authenticated session.
- You need the final HTTPS origin, such as
https://app.example.com.
Configure the project
In project chat, describe the feature and say that each app user connects their own account. Name the provider action, such as listing Slack channels or querying Notion content.
In the connector card, enter the Published app origin. Enter only the HTTPS origin, with no path, query, or fragment.
Select Configure. Swarmz enables only the requested operation and injects the server-only OAuth URL, connector gateway URL, and project gateway key.
Let the AI finish the connect, status, disconnect, and provider-action handlers. Check that every handler derives the app user ID from the authenticated server session.
Runtime flow
The browser calls your app's server route. That route verifies the app session and calls Swarmz with the project gateway key. For OAuth start, the browser is redirected only to the returned provider authorization URL. Provider tokens never pass through browser JavaScript or chat.
The app-user ID is not a browser parameter. Accepting it from a form, query string, header, or client-supplied JSON would let one user select another user's connection.
Verify the feature
- Sign in to the published app as test user A and connect the provider.
- Run one safe read, such as listing channels, pages, projects, or records.
- Sign in as test user B in a separate browser profile. Confirm that user A's connection is not shown.
- Connect user B, then repeat the read and confirm that the result belongs to B.
- Disconnect A. Confirm that A receives a connect-required state while B still works.
Use provider test data for write checks. Create an item, confirm it in the provider, then remove or archive it.
Recover a connection
- Not connected: show the connect control and start OAuth again.
- Permission required: reconnect and approve the permission needed by the operation.
- Reconnect required: the provider rejected or revoked the token. Reconnect the same app user.
- Rate limited: honor the returned retry delay. Do not loop immediately.
- Connector unavailable: ask the administrator to check visibility, OAuth status, and the connector feature flag.
Disconnect remains available when new connections are disabled. Removing a Swarmz connection does not delete provider content created through it.