1
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
2026-04-11 15:43:32 +08:00
parent f19e482c8f
commit 0981d6ee1b
78 changed files with 1102 additions and 8510 deletions

View File

@@ -11,6 +11,7 @@ import type {
import { buildAuthRequestContext } from '../auth/authRequestContext.js';
import {
bindWechatPhone,
buildAuthLoginOptionsResponse,
buildAuthMeResponse,
changeUserPhone,
createRefreshSession,
@@ -115,6 +116,14 @@ export function createAuthRoutes(context: AppContext) {
const router = Router();
const requireAuth = requireJwtAuth(context.config, context.userRepository);
router.get(
'/login-options',
routeMeta({ operation: 'auth.login_options' }),
asyncHandler(async (_request, response) => {
sendApiResponse(response, buildAuthLoginOptionsResponse(context));
}),
);
router.post(
'/entry',
routeMeta({ operation: 'auth.entry' }),
@@ -232,6 +241,7 @@ export function createAuthRoutes(context: AppContext) {
request.query.redirectPath,
context.config.wechatAuth.defaultRedirectPath,
);
const requestContext = buildAuthRequestContext(request);
const callbackUrl = new URL(
context.config.wechatAuth.callbackPath,
resolveRequestOrigin(request),
@@ -239,7 +249,12 @@ export function createAuthRoutes(context: AppContext) {
sendApiResponse(
response,
await startWechatLogin(context, callbackUrl, redirectPath),
await startWechatLogin(
context,
callbackUrl,
redirectPath,
requestContext,
),
);
}),
);