feat: add CNB login functionality and user management
- Introduced `cnb-login` route to handle user login via CNB token. - Created `CnbServices` class for managing CNB user interactions. - Added `findByCnbId` method in the User model to retrieve users by CNB ID. - Updated error handling to provide more structured error messages. - Enhanced user creation logic to handle CNB users. - Added tests for the new CNB login functionality.
This commit is contained in:
@@ -45,7 +45,7 @@ export const fetchToken = async (code: string, type: 'open' | 'mp' = 'open'): Pr
|
||||
appSecret = wx.appSecret;
|
||||
}
|
||||
if (!appId || !appSecret) {
|
||||
throw new CustomError(500, 'appId or appSecret is not set');
|
||||
throw new CustomError(500, { message: 'appId or appSecret is not set' });
|
||||
}
|
||||
console.log('fetchToken===', appId, appSecret, code);
|
||||
const wxUrl = `https://api.weixin.qq.com/sns/oauth2/access_token?appid=${appId}&secret=${appSecret}&code=${code}&grant_type=authorization_code`;
|
||||
|
||||
Reference in New Issue
Block a user