refactor(auth): inline NextAuth v4 config and simplify AuthPlatform API

- Inline NextAuth v4 handler directly in `[...nextauth]/route.ts`, removing
  the `@/lib/auth/nextauth` abstraction layer
- Add Google/Facebook providers with JWT/session callbacks that expose
  `idToken` and `accessToken` on the session for backend exchange
- Refactor `AuthPlatform` from constructor-based to static methods
  (`googleSignIn()` / `facebookSignIn()`)
- Update `auth-machine.ts` and layout comment reference to match new structure
- Align with original Dart `nextauth-helpers.{googleLogin, facebookLogin}()`
  naming and keep persistence concerns (unstorage, backend, custom cookies)
  out of scope for this iteration
This commit is contained in:
2026-06-12 17:20:56 +08:00
parent 1f83171067
commit dbc9a0cd13
6 changed files with 69 additions and 93 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ import "next-auth";
/**
* 扩展 next-auth v4 的 Session 类型
*
* `src/lib/auth/nextauth.ts` 的 jwt/session callbacks 把
* `src/app/api/auth/[...nextauth]/route.ts` 的 jwt/session callbacks 把
* - OAuth provider 名("google" | "facebook"
* - Google id_token
* - Facebook access_token