Using nextauth discord with vercel deployments

New to T3 and nextauth here, and I have a noob question: If I configure discord oauth, discord requires me to register exact URIs for login redirects, but Vercel deployments have dynamic URIs for each branch, so a new branch deployment will never match. I can get any deployment to work by manually adding its URL to the discord app management page, but is there a way to make it work for any vercel branch? If not, do you have a preferred workaround/working style that you think is most effective? Maybe I should just use username/pw login for branches
6 Replies
dzenda
dzenda7d ago
System Environment Variables Overview
Vercel Environment variables that are automatically populated by the System, such as the URL of the Deployment or the name of the Git branch deployed.
dzenda
dzenda7d ago
VERCEL_URL && VERCEL_BRANCH_URL
rdickert
rdickert6d ago
Hey, thanks for the reply! I think the issue is not solveable from the env var side though - I think nextauth is already sending the matching login redirect, so that info is probably already being accessed by the package. The problem is that Discord won't recognize that URI - I have to input it manually in their dashboard and they don't accept wildcards. I did find a possible workaround using alias for anyone that runs into this. I think I will set this aside in my own work since this isn't central to my application.
GitHub
Google Auth 2.0 redirect URI with Vercel preview deployment · verce...
Google Auth 2.0 doesn't allow for use of wild card (*). How could I make auth work on my NextJS app for Vercel preview deployment when the url is dynamically generated, and Google wants hardcod...
dzenda
dzenda6d ago
Oh I get what you mean
lanc3
lanc36d ago
You create a proxy auth service like t3-turbo does. It basically just serves a static URI for your preview environments. I don't remember the exact logic, but you can just reference t3 turbo
rdickert
rdickert5d ago
@lanc3 Oh wow, that's cool, thanks for pointing me there. For anyone following, here's the auth proxy
GitHub
create-t3-turbo/apps/auth-proxy/README.md at main · t3-oss/create-t...
Clean and simple starter repo using the T3 Stack along with Expo React Native - t3-oss/create-t3-turbo
Want results from more Discord servers?
Add your server
More Posts
Prevent Server Action from getting called if unrelated Search Param changesconst Page = async ({searchParams}: { searchParams: { type: string; }; }) => { cCreaete T3 No Req or Res in TRPC contextI am trying to integrate clerk with the trpc create context, but the createContext generated by creaPassing async data to server componentshey guys. I have a basic question - I'm fetching some "slow" data in a server component (at the pagI have been trying to get cache working with React-Query and Next.JSHello there, I'm trying to get this cache to work but I have searched far and wide and unless I'm blAnyone who knows CF Zero-Trust well?I have a homelob running proxmox, i have exposed it through a Tunnel, i have it behind Access too, iVercel server environment variables not pulling inI am currently using using [T3 Env](https://env.t3.gg/) for type safe environment variables however Shadcn Dialog + Form Error: React.Children.onlyHello, I'm want to use a From from shadcn inside a dialog from shadcn but I have this error : ErrorMost efficient monolith structure to have an Express.js REST API with Next.js SSR client?https://stackoverflow.com/questions/78670127/most-efficient-monolith-starter-project-structure-to-haView transitions aren't working with multiple elements with the same classnameHey, I have quite a unique problem and I tried searching for the solution but view transitions are rcreate t3 app breaking next-theme?????dudes and dudettes. im having a surreal issue with next theme. though if i initiated the whole app u