You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/api/docs/replace-oauth-server-with-better-auth.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,10 @@
1
1
**PRD: Replace Custom OAuth2 With Better Auth**
2
2
3
+
> Historical design note: its transport decisions are superseded by
4
+
> [`mcp-2026-07-28-migration.md`](./mcp-2026-07-28-migration.md). The current
5
+
> MCP implementation prefers CIMD and retains public Dynamic Client
6
+
> Registration for existing clients.
7
+
3
8
**Objective**
4
9
Replace SendLit’s custom OAuth2/auth implementation with Better Auth to support secure first-party web login, MCP OAuth, REST API authentication, and social login with Google plus Email OTP.
ALTERTABLE"oauth_client_resource" ADD CONSTRAINT"oauth_client_resource_client_id_oauth_client_client_id_fk"FOREIGN KEY ("client_id") REFERENCES"public"."oauth_client"("client_id") ON DELETE cascadeONUPDATE no action;
56
+
EXCEPTION
57
+
WHEN duplicate_object THEN null;
58
+
END $$;
59
+
--> statement-breakpoint
60
+
DO $$ BEGIN
61
+
ALTERTABLE"oauth_client_resource" ADD CONSTRAINT"oauth_client_resource_resource_id_oauth_resource_identifier_fk"FOREIGN KEY ("resource_id") REFERENCES"public"."oauth_resource"("identifier") ON DELETE cascadeONUPDATE no action;
62
+
EXCEPTION
63
+
WHEN duplicate_object THEN null;
64
+
END $$;
65
+
--> statement-breakpoint
66
+
CREATEINDEXIF NOT EXISTS "auth_oauth_client_resource_client_id_idx"ON"oauth_client_resource" USING btree ("client_id");--> statement-breakpoint
67
+
CREATEINDEXIF NOT EXISTS "auth_oauth_client_resource_resource_id_idx"ON"oauth_client_resource" USING btree ("resource_id");--> statement-breakpoint
68
+
CREATEUNIQUE INDEXIF NOT EXISTS "auth_oauth_client_resource_client_id_resource_id_idx"ON"oauth_client_resource" USING btree ("client_id","resource_id");--> statement-breakpoint
69
+
CREATEINDEXIF NOT EXISTS "auth_oauth_access_token_authorization_code_id_idx"ON"oauth_access_token" USING btree ("authorization_code_id");--> statement-breakpoint
70
+
CREATEINDEXIF NOT EXISTS "auth_oauth_refresh_token_authorization_code_id_idx"ON"oauth_refresh_token" USING btree ("authorization_code_id");
0 commit comments