# WeCom Integration Checklist ## 1) Backend Environment Variables Set these on the backend runtime: - Recommended start point: copy `backend/.env.production.example` to `backend/.env` and update values. - `WECOM_ENABLED=true` - `WECOM_CORP_ID=` - `WECOM_AGENT_ID=` - `WECOM_SECRET=` - `WECOM_REDIRECT_URI=https:///workspace` - `WECOM_AUTO_CREATE_USER=true` (or `false` if you require manual admin binding) - `WECOM_MATCH_RULES=employee_id,mobile` (supported: `employee_id,mobile,email`) - `WECOM_MATCH_OPERATOR=AND` (`AND` / `OR`) - `WECOM_EMPLOYEE_ID_SOURCE=userid` (or `extattr:`) - `WECOM_MOBILE_NORMALIZE=true` ## 2) Database Migration Run migrations after deployment: ```bash cd backend flask db upgrade ``` This applies: - WeCom user binding fields in `users` - Login audit table `login_audits` ## 3) WeCom Console Configuration In WeCom admin console (自建应用): 1. Configure application homepage URL to your HTTPS domain. 2. Configure OAuth trusted redirect domain. 3. Ensure callback URL matches `WECOM_REDIRECT_URI`. 4. Ensure users/groups are visible to the app. ## 4) Frontend Checks 1. Open `/workspace`. 2. Verify `企业微信登录 / Login with WeCom` button is shown. 3. Trigger login in WeCom and confirm redirect back to `/workspace`. 4. Verify session is stored and user enters workspace. ## 5) Admin Operations Available admin APIs: - `GET /api/admin/wecom/bindings` - `POST /api/admin/wecom/bind` - `POST /api/admin/wecom/unbind` - `GET /api/admin/wecom/login-audits` ## 6) Smoke Tests 1. Password login still works. 2. WeCom login success creates an audit record. 3. Invalid/expired state is rejected. 4. Disabled user cannot login via WeCom.