jamiedubs
jamiedubs
Explore posts from servers
TTCTheo's Typesafe Cult
Created by jamiedubs on 5/1/2023 in #questions
Best practices for data migrations/historical data changes?
I'm using t3 + Vercel + Planetscale and would like to add a field like user.apiToken as an example. A new field that every user should have pre-generated and ready to use So I need to generate tokens for my existing users. - Prisma migrations are SQL-only by default (right?) so that doesn't play nice - Planetscale doesn't really like Prisma migrations anyway Should I just be making a scripts/ directory and figuring out to run something like that against Vercel? Maybe a temporary API endpoint? What's a good best practice for one-off data migrations like this?
5 replies
TTCTheo's Typesafe Cult
Created by jamiedubs on 4/14/2023 in #questions
API token authentication w/ NextAuth
have any of you tried implementing something like this? Wondering if it's time for me to swap to Clerk or Auth0 or another solution or if this will work well enough. Private API, just provisioning my own tokens to access some privileged endpoints I've implemented a CredentialsProvider that works well enough, but it feels strange to be doing a cookie-session exchange and passing a (short-lived) cookie with requests, rather than, say, a long-lived Bearer auth token I'm specifically trying to use the API token auth with edge functions, which require NextAuth as middleware and aren't as easily side-stepped as a normal API function. In those cases I could do simple if(useSession || validApiToken)
5 replies