Files
cozsweet-frontend-nextjs/src/types/next-auth.d.ts
T
admin dbc9a0cd13 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
2026-06-12 17:20:56 +08:00

26 lines
856 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import "next-auth";
/**
* 扩展 next-auth v4 的 Session 类型
*
* `src/app/api/auth/[...nextauth]/route.ts` 的 jwt/session callbacks 把
* - OAuth provider 名("google" | "facebook"
* - Google id_token
* - Facebook access_token
* 塞进了 session 对象。
*
* 这里通过 TS 声明合并暴露给 `useSession()` 消费者。
*
* 注:声明文件全局生效(`globals.d.ts` 风格)—— 不用手动 import。
*/
declare module "next-auth" {
interface Session {
/** OAuth provider 名(首次 sign-in 时由 jwt callback 注入) */
provider?: "google" | "facebook";
/** Google OAuth id_token —— 调后端 /api/auth/google-login 换业务 token */
idToken?: string;
/** Facebook OAuth access_token —— 调后端 /api/auth/facebook-login 换业务 token */
accessToken?: string;
}
}