Socket
Book a DemoInstallSign in
Socket

@dub/better-auth

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dub/better-auth

Dub Better Auth Plugin

0.0.4
latest
npmnpm
Version published
Weekly downloads
985
-44.94%
Maintainers
2
Weekly downloads
 
Created
Source

Dub Analytics - Better Auth Plugin

Dub Analytics Plugin is a plugin for Dub that allows you to track conversion events in your Better Auth application.

Installation

npm install @dub/better-auth

Usage

Lead Tracking

By default, the plugin will track sign up events as leads. You can disable this by setting disableLeadTracking to true.

import { dubAnalytics } from "@dub/better-auth";
import { betterAuth } from "better-auth";
import { Dub } from "dub";

const dub = new Dub();

const betterAuth = betterAuth({
  plugins: [
    dubAnalytics({
      dubClient: dub,
    }),
  ],
});

OAuth

Dub Better Auth supports OAuth for authentication. You can configure the OAuth client ID and client secret in the dubAnalytics function.

dubAnalytics({
  dubClient: dub,
  oauth: {
    clientId: "your-client-id",
    clientSecret: "your-client-secret",
  },
});

And in the client, you need to use the dubAnalyticsClient plugin.

import { createAuthClient } from "better-auth/client"
import { dubAnalyticsClient } from "@dub/better-auth/client"

const authClient = createAuthClient({
  plugins: [dubAnalyticsClient()],
});

To link account with Dub, you need to use the dub.link.

const response = await authClient.dub.link({
  callbackURL: "/dashboard", // URL to redirect to after linking
});

Options

dubClient

The Dub client instance.

disableLeadTracking

Disable lead tracking for sign up events.

leadEventName

Event name for sign up leads.

customLeadTrack

Custom lead track function.

oauth

Dub OAuth configuration.

oauth.clientId

Client ID for Dub OAuth.

oauth.clientSecret

Client secret for Dub OAuth.

oauth.pkce

Enable PKCE for Dub OAuth.

License

MIT

Keywords

dub

FAQs

Package last updated on 26 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.