@@ -62,7 +62,7 @@ if (validStripeKey) {
6262export const auth = betterAuth ( {
6363 baseURL : getBaseUrl ( ) ,
6464 trustedOrigins : [
65- env . NEXT_PUBLIC_APP_URL ,
65+ getBaseUrl ( ) ,
6666 ...( env . NEXT_PUBLIC_SOCKET_URL ? [ env . NEXT_PUBLIC_SOCKET_URL ] : [ ] ) ,
6767 ] . filter ( Boolean ) ,
6868 database : drizzleAdapter ( db , {
@@ -319,7 +319,7 @@ export const auth = betterAuth({
319319 tokenUrl : 'https://github.com/login/oauth/access_token' ,
320320 userInfoUrl : 'https://api.github.com/user' ,
321321 scopes : [ 'user:email' , 'repo' , 'read:user' , 'workflow' ] ,
322- redirectURI : `${ env . NEXT_PUBLIC_APP_URL } /api/auth/oauth2/callback/github-repo` ,
322+ redirectURI : `${ getBaseUrl ( ) } /api/auth/oauth2/callback/github-repo` ,
323323 getUserInfo : async ( tokens ) => {
324324 try {
325325 const profileResponse = await fetch ( 'https://api.github.com/user' , {
@@ -400,7 +400,7 @@ export const auth = betterAuth({
400400 'https://www.googleapis.com/auth/gmail.labels' ,
401401 ] ,
402402 prompt : 'consent' ,
403- redirectURI : `${ env . NEXT_PUBLIC_APP_URL } /api/auth/oauth2/callback/google-email` ,
403+ redirectURI : `${ getBaseUrl ( ) } /api/auth/oauth2/callback/google-email` ,
404404 } ,
405405 {
406406 providerId : 'google-calendar' ,
@@ -414,7 +414,7 @@ export const auth = betterAuth({
414414 'https://www.googleapis.com/auth/calendar' ,
415415 ] ,
416416 prompt : 'consent' ,
417- redirectURI : `${ env . NEXT_PUBLIC_APP_URL } /api/auth/oauth2/callback/google-calendar` ,
417+ redirectURI : `${ getBaseUrl ( ) } /api/auth/oauth2/callback/google-calendar` ,
418418 } ,
419419 {
420420 providerId : 'google-drive' ,
@@ -428,7 +428,7 @@ export const auth = betterAuth({
428428 'https://www.googleapis.com/auth/drive.file' ,
429429 ] ,
430430 prompt : 'consent' ,
431- redirectURI : `${ env . NEXT_PUBLIC_APP_URL } /api/auth/oauth2/callback/google-drive` ,
431+ redirectURI : `${ getBaseUrl ( ) } /api/auth/oauth2/callback/google-drive` ,
432432 } ,
433433 {
434434 providerId : 'google-docs' ,
@@ -442,7 +442,7 @@ export const auth = betterAuth({
442442 'https://www.googleapis.com/auth/drive.file' ,
443443 ] ,
444444 prompt : 'consent' ,
445- redirectURI : `${ env . NEXT_PUBLIC_APP_URL } /api/auth/oauth2/callback/google-docs` ,
445+ redirectURI : `${ getBaseUrl ( ) } /api/auth/oauth2/callback/google-docs` ,
446446 } ,
447447 {
448448 providerId : 'google-sheets' ,
@@ -456,7 +456,7 @@ export const auth = betterAuth({
456456 'https://www.googleapis.com/auth/drive.file' ,
457457 ] ,
458458 prompt : 'consent' ,
459- redirectURI : `${ env . NEXT_PUBLIC_APP_URL } /api/auth/oauth2/callback/google-sheets` ,
459+ redirectURI : `${ getBaseUrl ( ) } /api/auth/oauth2/callback/google-sheets` ,
460460 } ,
461461
462462 {
@@ -471,7 +471,7 @@ export const auth = betterAuth({
471471 'https://www.googleapis.com/auth/forms.responses.readonly' ,
472472 ] ,
473473 prompt : 'consent' ,
474- redirectURI : `${ env . NEXT_PUBLIC_APP_URL } /api/auth/oauth2/callback/google-forms` ,
474+ redirectURI : `${ getBaseUrl ( ) } /api/auth/oauth2/callback/google-forms` ,
475475 } ,
476476
477477 {
@@ -487,7 +487,7 @@ export const auth = betterAuth({
487487 'https://www.googleapis.com/auth/devstorage.read_only' ,
488488 ] ,
489489 prompt : 'consent' ,
490- redirectURI : `${ env . NEXT_PUBLIC_APP_URL } /api/auth/oauth2/callback/google-vault` ,
490+ redirectURI : `${ getBaseUrl ( ) } /api/auth/oauth2/callback/google-vault` ,
491491 } ,
492492
493493 {
@@ -517,7 +517,7 @@ export const auth = betterAuth({
517517 accessType : 'offline' ,
518518 authentication : 'basic' ,
519519 pkce : true ,
520- redirectURI : `${ env . NEXT_PUBLIC_APP_URL } /api/auth/oauth2/callback/microsoft-teams` ,
520+ redirectURI : `${ getBaseUrl ( ) } /api/auth/oauth2/callback/microsoft-teams` ,
521521 } ,
522522
523523 {
@@ -532,7 +532,7 @@ export const auth = betterAuth({
532532 accessType : 'offline' ,
533533 authentication : 'basic' ,
534534 pkce : true ,
535- redirectURI : `${ env . NEXT_PUBLIC_APP_URL } /api/auth/oauth2/callback/microsoft-excel` ,
535+ redirectURI : `${ getBaseUrl ( ) } /api/auth/oauth2/callback/microsoft-excel` ,
536536 } ,
537537 {
538538 providerId : 'microsoft-planner' ,
@@ -554,7 +554,7 @@ export const auth = betterAuth({
554554 accessType : 'offline' ,
555555 authentication : 'basic' ,
556556 pkce : true ,
557- redirectURI : `${ env . NEXT_PUBLIC_APP_URL } /api/auth/oauth2/callback/microsoft-planner` ,
557+ redirectURI : `${ getBaseUrl ( ) } /api/auth/oauth2/callback/microsoft-planner` ,
558558 } ,
559559
560560 {
@@ -578,7 +578,7 @@ export const auth = betterAuth({
578578 accessType : 'offline' ,
579579 authentication : 'basic' ,
580580 pkce : true ,
581- redirectURI : `${ env . NEXT_PUBLIC_APP_URL } /api/auth/oauth2/callback/outlook` ,
581+ redirectURI : `${ getBaseUrl ( ) } /api/auth/oauth2/callback/outlook` ,
582582 } ,
583583
584584 {
@@ -593,7 +593,7 @@ export const auth = betterAuth({
593593 accessType : 'offline' ,
594594 authentication : 'basic' ,
595595 pkce : true ,
596- redirectURI : `${ env . NEXT_PUBLIC_APP_URL } /api/auth/oauth2/callback/onedrive` ,
596+ redirectURI : `${ getBaseUrl ( ) } /api/auth/oauth2/callback/onedrive` ,
597597 } ,
598598
599599 {
@@ -616,7 +616,7 @@ export const auth = betterAuth({
616616 accessType : 'offline' ,
617617 authentication : 'basic' ,
618618 pkce : true ,
619- redirectURI : `${ env . NEXT_PUBLIC_APP_URL } /api/auth/oauth2/callback/sharepoint` ,
619+ redirectURI : `${ getBaseUrl ( ) } /api/auth/oauth2/callback/sharepoint` ,
620620 } ,
621621
622622 {
@@ -628,7 +628,7 @@ export const auth = betterAuth({
628628 userInfoUrl : 'https://dummy-not-used.wealthbox.com' , // Dummy URL since no user info endpoint exists
629629 scopes : [ 'login' , 'data' ] ,
630630 responseType : 'code' ,
631- redirectURI : `${ env . NEXT_PUBLIC_APP_URL } /api/auth/oauth2/callback/wealthbox` ,
631+ redirectURI : `${ getBaseUrl ( ) } /api/auth/oauth2/callback/wealthbox` ,
632632 getUserInfo : async ( tokens ) => {
633633 try {
634634 logger . info ( 'Creating Wealthbox user profile from token data' )
@@ -662,7 +662,7 @@ export const auth = betterAuth({
662662 scopes : [ 'database.read' , 'database.write' , 'projects.read' ] ,
663663 responseType : 'code' ,
664664 pkce : true ,
665- redirectURI : `${ env . NEXT_PUBLIC_APP_URL } /api/auth/oauth2/callback/supabase` ,
665+ redirectURI : `${ getBaseUrl ( ) } /api/auth/oauth2/callback/supabase` ,
666666 getUserInfo : async ( tokens ) => {
667667 try {
668668 logger . info ( 'Creating Supabase user profile from token data' )
@@ -715,7 +715,7 @@ export const auth = betterAuth({
715715 responseType : 'code' ,
716716 prompt : 'consent' ,
717717 authentication : 'basic' ,
718- redirectURI : `${ env . NEXT_PUBLIC_APP_URL } /api/auth/oauth2/callback/x` ,
718+ redirectURI : `${ getBaseUrl ( ) } /api/auth/oauth2/callback/x` ,
719719 getUserInfo : async ( tokens ) => {
720720 try {
721721 const response = await fetch (
@@ -774,7 +774,7 @@ export const auth = betterAuth({
774774 accessType : 'offline' ,
775775 authentication : 'basic' ,
776776 prompt : 'consent' ,
777- redirectURI : `${ env . NEXT_PUBLIC_APP_URL } /api/auth/oauth2/callback/confluence` ,
777+ redirectURI : `${ getBaseUrl ( ) } /api/auth/oauth2/callback/confluence` ,
778778 getUserInfo : async ( tokens ) => {
779779 try {
780780 const response = await fetch ( 'https://api.atlassian.com/me' , {
@@ -824,7 +824,7 @@ export const auth = betterAuth({
824824 accessType : 'offline' ,
825825 authentication : 'basic' ,
826826 prompt : 'consent' ,
827- redirectURI : `${ env . NEXT_PUBLIC_APP_URL } /api/auth/oauth2/callback/discord` ,
827+ redirectURI : `${ getBaseUrl ( ) } /api/auth/oauth2/callback/discord` ,
828828 getUserInfo : async ( tokens ) => {
829829 try {
830830 const response = await fetch ( 'https://discord.com/api/users/@me' , {
@@ -895,7 +895,7 @@ export const auth = betterAuth({
895895 accessType : 'offline' ,
896896 authentication : 'basic' ,
897897 prompt : 'consent' ,
898- redirectURI : `${ env . NEXT_PUBLIC_APP_URL } /api/auth/oauth2/callback/jira` ,
898+ redirectURI : `${ getBaseUrl ( ) } /api/auth/oauth2/callback/jira` ,
899899 getUserInfo : async ( tokens ) => {
900900 try {
901901 const response = await fetch ( 'https://api.atlassian.com/me' , {
@@ -946,7 +946,7 @@ export const auth = betterAuth({
946946 accessType : 'offline' ,
947947 authentication : 'basic' ,
948948 prompt : 'consent' ,
949- redirectURI : `${ env . NEXT_PUBLIC_APP_URL } /api/auth/oauth2/callback/airtable` ,
949+ redirectURI : `${ getBaseUrl ( ) } /api/auth/oauth2/callback/airtable` ,
950950 } ,
951951
952952 // Notion provider
@@ -963,7 +963,7 @@ export const auth = betterAuth({
963963 accessType : 'offline' ,
964964 authentication : 'basic' ,
965965 prompt : 'consent' ,
966- redirectURI : `${ env . NEXT_PUBLIC_APP_URL } /api/auth/oauth2/callback/notion` ,
966+ redirectURI : `${ getBaseUrl ( ) } /api/auth/oauth2/callback/notion` ,
967967 getUserInfo : async ( tokens ) => {
968968 try {
969969 const response = await fetch ( 'https://api.notion.com/v1/users/me' , {
@@ -1013,7 +1013,7 @@ export const auth = betterAuth({
10131013 accessType : 'offline' ,
10141014 authentication : 'basic' ,
10151015 prompt : 'consent' ,
1016- redirectURI : `${ env . NEXT_PUBLIC_APP_URL } /api/auth/oauth2/callback/reddit` ,
1016+ redirectURI : `${ getBaseUrl ( ) } /api/auth/oauth2/callback/reddit` ,
10171017 getUserInfo : async ( tokens ) => {
10181018 try {
10191019 const response = await fetch ( 'https://oauth.reddit.com/api/v1/me' , {
@@ -1058,7 +1058,7 @@ export const auth = betterAuth({
10581058 tokenUrl : 'https://api.linear.app/oauth/token' ,
10591059 scopes : [ 'read' , 'write' ] ,
10601060 responseType : 'code' ,
1061- redirectURI : `${ env . NEXT_PUBLIC_APP_URL } /api/auth/oauth2/callback/linear` ,
1061+ redirectURI : `${ getBaseUrl ( ) } /api/auth/oauth2/callback/linear` ,
10621062 pkce : true ,
10631063 prompt : 'consent' ,
10641064 accessType : 'offline' ,
@@ -1145,7 +1145,7 @@ export const auth = betterAuth({
11451145 responseType : 'code' ,
11461146 accessType : 'offline' ,
11471147 prompt : 'consent' ,
1148- redirectURI : `${ env . NEXT_PUBLIC_APP_URL } /api/auth/oauth2/callback/slack` ,
1148+ redirectURI : `${ getBaseUrl ( ) } /api/auth/oauth2/callback/slack` ,
11491149 getUserInfo : async ( tokens ) => {
11501150 try {
11511151 logger . info ( 'Creating Slack bot profile from token data' )
@@ -1413,7 +1413,7 @@ export const auth = betterAuth({
14131413 try {
14141414 const { invitation, organization, inviter } = data
14151415
1416- const inviteUrl = `${ env . NEXT_PUBLIC_APP_URL } /invite/${ invitation . id } `
1416+ const inviteUrl = `${ getBaseUrl ( ) } /invite/${ invitation . id } `
14171417 const inviterName = inviter . user ?. name || 'A team member'
14181418
14191419 const html = await renderInvitationEmail (
0 commit comments