Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix wechat login error: make next-auth compatible for text/plain response type #6585

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open
Changes from 19 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
323cfbf
fix: wechat text/plain error
xiangnanscu Feb 21, 2025
ebf4330
Merge branch 'lobehub:main' into wechat
xiangnanscu Feb 26, 2025
d0a2026
Update wechat.ts
xiangnanscu Feb 27, 2025
0286fbf
Merge branch 'wechat' of github.com:xiangnanscu/lobe-chat into main
xiangnanscu Feb 27, 2025
d88c519
🔧 fix: Refactor WeChat SSO token configuration
xiangnanscu Feb 27, 2025
bd7fba1
Merge branch 'lobehub:main' into main
xiangnanscu Feb 27, 2025
f827744
✨ feat(wechat): Add styling for WeChat SSO provider
xiangnanscu Feb 28, 2025
6a7d2e3
Merge branch 'lobehub:main' into main
xiangnanscu Feb 28, 2025
8535f7b
Merge branch 'main' of https://github.com/lobehub/lobe-chat
actions-user Feb 28, 2025
b894575
✨ feat(wechat): Add styling for WeChat SSO provider
xiangnanscu Feb 28, 2025
f7a36ee
Merge branch 'main' of github.com:xiangnanscu/lobe-chat into main
xiangnanscu Feb 28, 2025
68278f5
Merge branch 'main' of https://github.com/lobehub/lobe-chat
actions-user Mar 1, 2025
48564be
Merge branch 'main' of https://github.com/lobehub/lobe-chat
actions-user Mar 2, 2025
38e53a0
Merge branch 'main' of https://github.com/lobehub/lobe-chat
actions-user Mar 2, 2025
664b497
Merge branch 'main' of https://github.com/lobehub/lobe-chat
actions-user Mar 2, 2025
23ec7b4
Merge branch 'main' of https://github.com/lobehub/lobe-chat
actions-user Mar 3, 2025
069e1f7
Merge branch 'main' of https://github.com/lobehub/lobe-chat
actions-user Mar 3, 2025
46ad1e2
Merge branch 'main' of https://github.com/lobehub/lobe-chat
actions-user Mar 3, 2025
f1f0097
Merge branch 'main' of https://github.com/lobehub/lobe-chat
actions-user Mar 4, 2025
c8c133b
Merge branch 'main' of https://github.com/lobehub/lobe-chat
actions-user Mar 5, 2025
00c30d9
Merge branch 'main' of https://github.com/lobehub/lobe-chat
actions-user Mar 5, 2025
79d7813
Merge branch 'main' of https://github.com/lobehub/lobe-chat
actions-user Mar 6, 2025
91f64fc
Merge branch 'main' of https://github.com/lobehub/lobe-chat
actions-user Mar 7, 2025
4fcfb4a
Merge branch 'main' of https://github.com/lobehub/lobe-chat
actions-user Mar 7, 2025
a09c6e2
Merge branch 'main' of https://github.com/lobehub/lobe-chat
actions-user Mar 7, 2025
8f03a91
Merge branch 'main' of https://github.com/lobehub/lobe-chat
actions-user Mar 8, 2025
4e31cde
Merge branch 'main' of https://github.com/lobehub/lobe-chat
actions-user Mar 8, 2025
ef2cccb
Merge branch 'main' of https://github.com/lobehub/lobe-chat
actions-user Mar 9, 2025
a71490f
Merge branch 'main' of https://github.com/lobehub/lobe-chat
actions-user Mar 9, 2025
9323d32
Merge branch 'main' of https://github.com/lobehub/lobe-chat
actions-user Mar 9, 2025
21deb5b
Merge branch 'main' of https://github.com/lobehub/lobe-chat
actions-user Mar 10, 2025
bb8895a
Merge branch 'main' of https://github.com/lobehub/lobe-chat
actions-user Mar 10, 2025
27d72eb
Merge branch 'main' of https://github.com/lobehub/lobe-chat
actions-user Mar 11, 2025
6effa12
Merge branch 'main' of https://github.com/lobehub/lobe-chat
actions-user Mar 11, 2025
e4bd57c
Merge branch 'main' of https://github.com/lobehub/lobe-chat
actions-user Mar 12, 2025
ccddc72
Merge branch 'main' of https://github.com/lobehub/lobe-chat
actions-user Mar 13, 2025
d708034
Merge branch 'main' of https://github.com/lobehub/lobe-chat
actions-user Mar 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/libs/next-auth/sso-providers/wechat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const provider = {
clientId: process.env.AUTH_WECHAT_ID,
clientSecret: process.env.AUTH_WECHAT_SECRET,
platformType: 'WebsiteApp',
profile: (profile) => {
profile: (profile: any) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的 Profile 是可以配置 type 的,不用指定成 any,你看看是不是没配置?

return {
email: null,
id: profile.unionid,
Expand All @@ -18,6 +18,18 @@ const provider = {
providerAccountId: profile.unionid,
};
},
style: { bg: '#fff', logo: 'https://authjs.dev/img/providers/wechat.svg', text: '#000' },
token: {
async conform(response: any) {
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',
},
}),
};

Expand Down