refactor(auth): switch to class-based social login and v4 route handler
Migrate from function-based social login helpers (`facebookLogin`, `googleLogin`) to class-based services (`new FacebookLogin().signIn()`, `new GoogleLogin().signIn()`), updating call sites in `AuthFacebookPanel` and `SplashButton` with try/catch error handling. The NextAuth route handler is also refactored to the v4 pattern, importing pre-built `GET` / `POST` exports from `@/lib/auth/nextauth` instead of constructing the handler inline with `NextAuth(authOptions)`.
This commit is contained in:
@@ -4,13 +4,13 @@
|
||||
* 集中管理应用中使用的常量值
|
||||
* 原始 Dart: lib/res/constants.dart
|
||||
*
|
||||
* 注意:
|
||||
* - `facebookAppId` / `googleClientId` 优先从 `process.env.NEXT_PUBLIC_*` 读取,
|
||||
* 缺省回退到 Dart 端的硬编码值(与 `lib/auth/config.ts` 的 `?? ""` 行为不同——
|
||||
* 此处保留默认值便于未配 env 的本地开发)。
|
||||
* - `appTitle` / `appUrl` 复用 `core/net/config/api_config.ts` 的 `getAppEnv()`,
|
||||
* 其底层为 `process.env.NEXT_PUBLIC_APP_ENV`(三态:`development` / `test` / `production`),
|
||||
* 与 `.env.example` 的约定一致。
|
||||
* 清理记录:本轮移除 `facebookAppId` / `googleClientId` 字段 —— Next.js 端
|
||||
* 不再硬编码 OAuth 凭据,改为由 `@/lib/auth/nextauth.ts` 从 `AUTH_*_ID` /
|
||||
* `AUTH_*_SECRET` env 读取(Auth.js v5 命名约定)。原硬编码值已废弃。
|
||||
*
|
||||
* `appTitle` / `appUrl` 复用 `core/net/config/api_config.ts` 的 `getAppEnv()`,
|
||||
* 其底层为 `process.env.NEXT_PUBLIC_APP_ENV`(三态:`development` / `test` / `production`),
|
||||
* 与 `.env.example` 的约定一致。
|
||||
*/
|
||||
import { getAppEnv } from "@/core/net/config/api_config";
|
||||
|
||||
@@ -25,15 +25,6 @@ export class AppConstants {
|
||||
static readonly termsOfServiceUrl =
|
||||
"https://docs.google.com/document/d/1ZL5-uDKLNQrkNnWNKlVFi5atwA9hBpNVyoXzzXf1GHs/edit?usp=sharing";
|
||||
|
||||
/** Facebook App ID(env 覆盖优先,缺省回退到 Dart 端硬编码值) */
|
||||
static readonly facebookAppId =
|
||||
process.env.NEXT_PUBLIC_FACEBOOK_APP_ID ?? "26934819589512827";
|
||||
|
||||
/** Google Auth Client ID(env 覆盖优先,缺省回退到 Dart 端硬编码值) */
|
||||
static readonly googleClientId =
|
||||
process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID ??
|
||||
"351948560061-isubggf6eahfii9n0stpf2qu3haralro.apps.googleusercontent.com";
|
||||
|
||||
/** 开发环境 APP 标题 */
|
||||
static readonly appTitleDevelopment = "Develop";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user