feat: integrate WeChat Open Platform QR code login
- Add WeChat service for OAuth2 authentication flow - Add WeChat routes (/api/wechat/login, /api/wechat/callback) - Add WeChat types for login state and responses - Update EntryQRCode component to support WeChat login - Add WeChat config options (appId, appSecret, redirectUri) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,3 +4,4 @@ export * from './vote.types';
|
||||
export * from './draw.types';
|
||||
export * from './admin.types';
|
||||
export * from './scan-login.types';
|
||||
export * from './wechat.types';
|
||||
|
||||
54
packages/shared/src/types/wechat.types.ts
Normal file
54
packages/shared/src/types/wechat.types.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
// WeChat Open Platform login types
|
||||
|
||||
export interface WechatLoginState {
|
||||
state: string;
|
||||
pcSocketId: string;
|
||||
createdAt: number;
|
||||
expiresAt: number;
|
||||
}
|
||||
|
||||
export interface WechatLoginResponse {
|
||||
success: boolean;
|
||||
data?: {
|
||||
authUrl: string;
|
||||
state: string;
|
||||
expiresAt: number;
|
||||
};
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export interface WechatCallbackResult {
|
||||
success: boolean;
|
||||
openid?: string;
|
||||
pcSocketId?: string;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export interface WechatAccessTokenResponse {
|
||||
access_token?: string;
|
||||
expires_in?: number;
|
||||
refresh_token?: string;
|
||||
openid?: string;
|
||||
scope?: string;
|
||||
errcode?: number;
|
||||
errmsg?: string;
|
||||
}
|
||||
|
||||
export interface WechatUserInfo {
|
||||
openid: string;
|
||||
nickname?: string;
|
||||
sex?: number;
|
||||
province?: string;
|
||||
city?: string;
|
||||
country?: string;
|
||||
headimgurl?: string;
|
||||
privilege?: string[];
|
||||
unionid?: string;
|
||||
}
|
||||
|
||||
export interface WechatLoginSuccessPayload {
|
||||
openid: string;
|
||||
sessionToken: string;
|
||||
userId: string;
|
||||
userInfo?: WechatUserInfo;
|
||||
}
|
||||
Reference in New Issue
Block a user