WeChat Integration
- WeChat-related integrations cover many scenarios
- WeChat Pay
- WeChat Official Account Login
- WeChat Official Account QR Code Follow & Login
QR Code Follow & Login (Official Account)
- Reference: https://ai.minihuo.com
- Use case: typically on a desktop browser
- Pull QR code from
/oauth/weixin/chat
json
{
"ticket": "gQH88DwAAAAAAAAAAS5odHRwOi8vd2VpeGluLnFxLmNvbS9xLzAyaGtSNnNQdTVkMEMxYUlIYmhDYzMAAgScnQtmAwQQDgAA",
"expire_seconds": 3600,
"url": "http://weixin.qq.com/q/02hkR6sPu5d0C1aIHbhCc3",
"checkUrl": "/oauth/weixin/token/chat:Dnqffxgt"
}{
"ticket": "gQH88DwAAAAAAAAAAS5odHRwOi8vd2VpeGluLnFxLmNvbS9xLzAyaGtSNnNQdTVkMEMxYUlIYmhDYzMAAgScnQtmAwQQDgAA",
"expire_seconds": 3600,
"url": "http://weixin.qq.com/q/02hkR6sPu5d0C1aIHbhCc3",
"checkUrl": "/oauth/weixin/token/chat:Dnqffxgt"
}- After the user follows, write the
wxidto the backend and store it in Redis - Poll
checkUrlto check if the user has scanned (checks Redis forwxid); if found, set cookies accordingly
WeChat Official Account Login (In-App)
- Use case: inside WeChat on mobile
- Reference: visit https://ai.minihuo.com inside WeChat
- Redirect to
https://www.lingduquan.com/oauth/weixin?f=chat— this sets a cookie based on the source - Step 2: determine which
wxappbased on source, then get the required key and URL - Step 3: get
codeand complete login
HIGO