Authorize GitHub, Slack, Linear, and Google Workspace so your plugin handlers can fetch tokens without ever touching credentials directly.
Toolshed acts as an OAuth broker between your agents and third-party services. When a user connects an integration, Toolshed handles the full OAuth flow — authorization redirect, code exchange, token encryption, and storage — and then vends short-lived access tokens to plugin handlers on demand. Your plugin code calls ctx.auth.getToken("provider") and receives a ready-to-use token; it never sees credentials at rest.
To connect a user to a provider, redirect them to:
GET /api/auth/:provider/login?userId=<userId>
The userId query parameter is required — it ties the stored token to a specific user in your system. Toolshed redirects the user to the provider’s authorization page, handles the callback, and stores the encrypted token automatically.
GitHub
Slack
Linear
Google
# Redirect the user to connect their GitHub accountGET /api/auth/github/login?userId=user_abc123
After the user authorizes, Toolshed stores their token and redirects back with:
To revoke a user’s connection to a provider, send a DELETE request. Toolshed revokes the token at the provider (best-effort) and removes it from storage:
Once a user has connected an integration, you do not need to manage tokens yourself. Every tool handler receives a ctx object with an auth resolver — just call ctx.auth.getToken("provider") and Toolshed vends the stored token automatically.
Here is how the GitHub plugin uses this in practice:
async handler(ctx, input) { // Toolshed decrypts and vends the stored token — no credentials in your code const token = await ctx.auth.getToken("github") const res = await fetch( `https://api.github.com/repos/${input.owner}/${input.repo}/issues`, { headers: { Authorization: `Bearer ${token}`, Accept: "application/vnd.github.v3+json", }, } ) return await res.json()}
If the user has not connected the required provider, getToken() throws and the tool returns an error to the agent — no partial credentials are leaked.
When you build your plugin with definePlugin(), list the OAuth providers your tools depend on in the authProviders array. This lets Toolshed’s UI prompt users to connect before they try to invoke a tool: