@lobehub/chat
Version:
Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.
37 lines (33 loc) • 1.16 kB
text/typescript
import WeChat, { WeChatProfile } from '@auth/core/providers/wechat';
import { CommonProviderConfig } from './sso.config';
const provider = {
id: 'wechat',
provider: WeChat({
...CommonProviderConfig,
clientId: process.env.AUTH_WECHAT_ID,
clientSecret: process.env.AUTH_WECHAT_SECRET,
platformType: 'WebsiteApp',
profile: (profile: WeChatProfile) => {
return {
email: null,
id: profile.unionid,
image: profile.headimgurl,
name: profile.nickname,
providerAccountId: profile.unionid,
};
},
style: { bg: '#fff', logo: 'https://authjs.dev/img/providers/wechat.svg', text: '#000' },
token: {
async conform(response: Response) {
const data = await response.json();
console.log('wechat data:', data);
return new Response(JSON.stringify({ ...data, token_type: 'bearer' }), {
headers: { 'Content-Type': 'application/json' },
});
},
params: { appid: process.env.AUTH_WECHAT_ID, secret: process.env.AUTH_WECHAT_SECRET },
url: 'https://api.weixin.qq.com/sns/oauth2/access_token',
},
}),
};
export default provider;