The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
chore: Refactor OAuth token creation and deletion
Kiran Kab74443809a3
diff --git a/apps/web/app/api/oauth/token/create-token.ts b/apps/web/app/api/oauth/token/create-token.tsnew file mode 100644index 0000000000..e69de29bb2diff --git a/apps/web/app/api/oauth/token/refresh-access-token.ts b/apps/web/app/api/oauth/token/refresh-access-token.tsindex 853ff02aca..af2f3f9b1c 100644--- a/apps/web/app/api/oauth/token/refresh-access-token.ts+++ b/apps/web/app/api/oauth/token/refresh-access-token.ts@@ -107,10 +107,18 @@ export const refreshAccessToken = async (Date.now() + OAUTH_ACCESS_TOKEN_LIFETIME * 1000,);- await Promise.all([+ await prisma.$transaction([+ // Delete the old access token+ prisma.restrictedToken.delete({+ where: {+ id: accessTokenId,+ },+ }),+// Create the access token and refresh tokenprisma.restrictedToken.create({data: {+ clientId,userId,projectId,scopes,@@ -130,21 +138,6 @@ export const refreshAccessToken = async (},},}),-- // Delete the old access token- prisma.restrictedToken.delete({- where: {- id: accessTokenId,- },- }),-- // Delete the old refresh token- // TODO: We we may not do this, cascade delete should take care of this- prisma.oAuthRefreshToken.delete({- where: {- id: refreshTokenId,- },- }),]);const response = {