--- title: "defineAuthResolver()" description: "Define a custom auth resolver for a specific integration" --- Auth Resolvers allow you to inject the authentication credentials of **your users**, using a third-party service like [Clerk](https://clerk.com/) or [Nango](https://www.nango.dev/) or your own custom solution. See our [Bring-your-own Auth Guide](/documentation/guides/using-integrations-byo-auth) for more about how this works. ```ts example client.defineAuthResolver(slack, async (ctx) => { if (!ctx.account?.id) { return; } const tokens = await clerk.users.getUserOauthAccessToken(ctx.account.id, "oauth_slack"); if (tokens.length === 0) { throw new Error(`Could not find Slack auth for account ${ctx.account.id}`); } return { type: "oauth", token: tokens[0].token, }; }); ``` ## Parameters The Integration client (e.g. `slack`) to define the auth resolver for. The resolver function to use for this integration. Should return a [AuthResolverResult](#authresolverresult) object. {" "} The [TriggerContext](/sdk/context) object for the run that is requesting authentication. The Integration client that is requesting authentication. ## AuthResolverResult Should be either "apiKey" or "oauth" The authentication token to use for this integration. Additional fields to pass to the integration.