Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Dogfood `dub` for login links

Steven Tey6e0b4c3929db
diff --git a/apps/web/lib/auth/options.ts b/apps/web/lib/auth/options.ts
index fc239bdf37..8ec406ae39 100644
--- a/apps/web/lib/auth/options.ts
+++ b/apps/web/lib/auth/options.ts
@@ -23,12 +23,25 @@ const VERCEL_DEPLOYMENT = !!process.env.VERCEL_URL;
export const authOptions: NextAuthOptions = {
providers: [
EmailProvider({
- sendVerificationRequest({ identifier, url }) {
+ async sendVerificationRequest({ identifier, url }) {
+ let link = url;
+ try {
+ const { shortLink } = await dub.links.create({
+ domain: "d.to",
+ url,
+ archived: true,
+ tagIds: ["clz20tm1f0003onht3q6f11me"],
+ });
+ link = shortLink;
+ } catch (error) {
+ console.error(error);
+ }
+
if (process.env.NODE_ENV === "development") {
- console.log(`Login link: ${url}`);
+ console.log(`Login link: ${link}`);
return;
} else {
- sendEmail({
+ await sendEmail({
email: identifier,
subject: `Your ${process.env.NEXT_PUBLIC_APP_NAME} Login Link`,
react: LoginLink({ url, email: identifier }),