整合 WeChat WiFi 登入:透過社群 Captive Portals 捕捉互動參與
本指南詳細介紹如何將 WeChat WiFi 驗證整合至企業級 Captive Portals 中,內容涵蓋 OAuth 2.0 架構、RADIUS 整合,以及在 Cisco Meraki、HPE Aruba 和 Juniper Mist 硬體上的逐步部署步驟。它為 IT 經理和網路架構師提供了一個實用框架,在吸引 WeChat 13 億用戶的同時捕捉第一方數據,並透過關注公眾號和登入後重新導向來推動互動參與。
收聽此指南
查看播客逐字稿

執行摘要
整合 WeChat WiFi 登入可將標準的 Captive Portal 轉化為策略性的第一方數據引擎,適用於服務中國遊客及更廣泛 WeChat 生態系統的場所。對於 IT 經理和網路架構師而言,透過 OAuth 2.0 和 RADIUS 部署 WeChat 登入,需要在無摩擦的訪客存取與安全、合規的數據收集之間取得平衡。本指南詳細介紹了在包括 Cisco Meraki、HPE Aruba、Ruckus 和 Juniper Mist 在內的硬體企業網路中,部署 WeChat WiFi 驗證的技術架構、實作步驟和安全考量。它展示了 Purple 的 Guest WiFi 平台如何協調 OAuth 流程、將個人資料數據對應到您的 CRM,並透過登入後重新導向至您的 WeChat 公眾號來推動互動。
WeChat 擁有超過 13 億的月活躍用戶,根據世界觀光組織的數據,中國遊客在 2023 年的國際消費估計達 2550 億美元。對於飯店、奢華零售、機場和會議中心而言,提供 WeChat WiFi 登入是觸及該客群的直接管道。Purple 在全球 80,000 多個實際場所營運,並在 2024 年記錄了 4.4 億次登入,這使我們能夠直接洞察實際部署中的成功與失敗案例。
技術深度解析
WeChat WiFi 驗證的工作原理
WeChat WiFi 驗證以直接整合至 Captive Portal 體驗中的 OAuth 2.0 流程取代了手動表單輸入。該順序涉及五個元件依定義的順序進行通訊:
- 訪客的裝置連線至場所的 SSID。
- 無線基地台攔截未經驗證的 HTTP 流量,並將裝置重新導向至由 Purple 託管的 Captive Portal。
- 使用者在歡迎頁面上選擇 WeChat 登入選項。
- 入口網站向 WeChat 開放平台 API 發起 OAuth 2.0 授權請求,並傳遞場所的 AppID 和重新導向 URI。
- 裝置上開啟 WeChat 應用程式,並提示使用者授權連線。
- WeChat 將授權碼傳回至重新導向 URI。
- Purple 平台將該授權碼兌換為存取權杖(Access Token),並擷取使用者的個人資料數據:OpenID、unionid、暱稱、頭像和註冊位置。
- Purple 向 RADIUS 伺服器發送訊號,以向無線基地台發送 Access-Accept 訊息。
- 無線基地台授予網際網路存取權限,並套用已設定的策略(VLAN 分配、頻寬限制、工作階段逾時)。
- 入口網站將使用者重新導向至場所的 WeChat 公眾號或目標到達網頁。

帳號類型要求
這是 WeChat WiFi 部署中最常見的單一故障點。您必須使用已驗證的 WeChat 服務號 (服务号)。訂閱號 (订阅号) 不提供 Captive Portal 整合所需的 OAuth 2.0 網頁授權 API。下表總結了關鍵差異:
| 功能 | 服務號 (服务号) | 訂閱號 (订阅号) |
|---|---|---|
| OAuth 2.0 WiFi 登入 | 是 | 否 |
| API 存取權限級別 | 完整 | 受限 |
| 每月推送訊息數 | 4 | 30 |
| 顯示為聯絡人 | 是 | 摺疊於資料夾中 |
| WeChat Pay 整合 | 是 | 否 |
| 需要驗證 | 是 | 是 |
取得已驗證的服務號需要中國營業執照或透過騰訊進行特殊的海外申請流程,這需要支付 99 美元的年度驗證費,且審查期為二至四週。
圍牆花園:最關鍵的網路設定
圍牆花園(Walled Garden,也稱為驗證前白名單)定義了裝置在完成 Captive Portal 驗證之前可以存取的 IP 位址和網域。如果 WeChat API 網域不在圍牆花園中,裝置將無法發起 OAuth 握手,且登入會靜默失敗。
最起碼必須將以下網域加入白名單:
*.weixin.qq.com*.wechat.com*.wx.qq.comres.wx.qq.commp.weixin.qq.com- WeChat CDN IP 範圍(請參閱騰訊發佈的 IP 範圍文件,因為這些會定期變更)
在 Cisco Meraki 上,於 Wireless > Access Control > Walled Garden 下進行設定。在 HPE Aruba 上,使用 Captive Portal Profile 白名單。在 Juniper Mist 上,設定 Guest Portal 允許的網域清單。
RADIUS 整合與策略執行
在此架構中,Purple 充當 RADIUS 代理。在 WeChat OAuth 交換成功後,Purple 會向場所的無線控制器發送 RADIUS Access-Accept 訊息。Access-Accept 訊息可以攜帶標準 RADIUS 屬性以執行每位使用者的策略:
- 用於 VLAN 分配的
Tunnel-Type和Tunnel-Private-Group-ID(將訪客流量與企業網路隔離,符合 IEEE 802.1X 分段最佳實踐) - 用於在定義的時間段後自動中斷連線的
Session-Timeout - 用於頻寬限制的
WISPr-Bandwidth-Max-Up和WISPr-Bandwidth-Max-Down
此架構與硬體無關。Purple 可與 Cisco Meraki、HPE Aruba、Ruckus、Juniper Mist、Ubiquiti UniFi、Cambium、Extreme 和 Fortinet 整合,無需變更韌體或增加額外的本地端伺服器。

實作指南
步驟 1:設定 WeChat 開發者帳號
登入位於 mp.weixin.qq.com 的 WeChat 公眾號平台。導覽至 設定 > 安全中re > 網頁授權**。啟用 OAuth 2.0 網頁授權,並將您的 Captive Portal 網域新增為授權的回呼網域(例如:wifi.yourvenue.com)。WeChat 僅會將授權碼傳回至此處註冊的網域 - 若不匹配將導致無聲失敗。
從 開發 > 基本配置 面板中取得您的 AppID 和 AppSecret。請安全地儲存 AppSecret;將其視為私鑰。
步驟 2:設定 Purple
在 Purple 傳送門中,導覽至 驗證 > 社群登入 並啟用 WeChat。輸入 AppID 和 AppSecret。使用 Purple 的拖放式編輯器設計 Captive Portal 歡迎頁面。將 WeChat 登入按鈕設為首屏(above the fold)的主要行動呼籲(CTA)。
設定驗證後的重新導向。選項包括:
- 場所的 WeChat 官方帳號關注頁面(推薦用於提高互動率)
- 託管於 WeChat 小程式中的促銷落地頁
- 使用 Purple WiFi Analytics 工具的問卷調查頁面
- 會員計劃註冊頁面
在 驗證 > 回訪者設定 下啟用 MAC 位址快取。將快取保留時間設定為符合您典型的到訪頻率(零售業為 7 天,旅宿業為 30 天)。回訪者將自動連線,無需再次看到傳送門,而他們的到訪仍會記錄在分析儀表板中。
步驟 3:設定網路硬體
在您的無線控制器上,將訪客 SSID 設定為使用外部 Captive Portal。輸入 Purple 傳送門 URL 作為歡迎頁面 URL。將 WeChat 網域新增至圍牆花園(walled garden)。設定 Purple 提供的 RADIUS 伺服器 IP 位址和共用金鑰。
在上線前,使用行動裝置測試完整流程。具體步驟:
- 連線至訪客 SSID。
- 確認 Captive Portal 在 Captive Portal Assistant (CPA) 微型瀏覽器中載入。
- 點擊 WeChat 登入按鈕,並確認 WeChat 應用程式已開啟。
- 授權連線,並確認已授予網際網路存取權限。
- 確認登入後的重新導向正確觸發。
最佳實踐
最佳化圍牆花園。 設定錯誤的圍牆花園是實際運作中 WeChat 登入失敗的首要原因。在推出前進行測試,並在任何網路韌體更新後重新測試,因為某些控制器在升級期間會重設白名單項目。
推動登入後的互動。 驗證後的那一刻是訪客 WiFi 體驗中注意力最高的時候。將使用者重新導向至您的官方帳號關注頁面。關注您帳號的訪客在離開場所後很長一段時間內,仍可透過推播通知與其聯繫。
為回訪者實作 MAC 快取。 每次到訪都要求重複驗證會降低體驗品質。MAC 快取消除了回訪客的摩擦,同時仍能記錄到訪以進行分析。請參閱 Purple 的 WiFi Analytics 以獲取停留時間和回訪報告。
應用資料最小化原則。 僅請求您的 CRM 實際使用的 WeChat 個人檔案欄位。請求不必要的權限會增加授權放棄率,並增加 GDPR 合規性的複雜度。對於大多數場所,OpenID、暱稱和頭像已足夠用於個人化。
透過 VLAN 區隔訪客流量。 將通過 WeChat 驗證的訪客分配到專用的 VLAN,與您的企業或 POS 網路隔離。這符合 PCI DSS 網路區隔要求,並限制了任何訪客端安全性事件的波及範圍。如需 WiFi 安全架構的完整說明,請參閱我們的 企業 WiFi 安全指南 。
遵守 GDPR 和 PIPL。 在使用者啟動 WeChat OAuth 流程之前,在歡迎頁面上顯示清晰的隱私權聲明。該聲明必須識別資料控制者、列出從 WeChat 收集的資料類別、說明處理的法律依據,並提供完整隱私權政策的連結。如需詳細指引,請參閱我們的 WiFi GDPR 合規指南 。
疑難排解與風險緩解
OAuth 重新導向不匹配
如果在 WeChat 開發者主控台中註冊的回呼 URL 與 Purple 用於重新導向的 URL 不完全匹配,WeChat 將傳回錯誤碼並封鎖授權。檢查協定是否不匹配(HTTP 與 HTTPS)、結尾斜線以及子網域差異。註冊的網域必須完全符合字串。
Captive Portal Assistant (CPA) 干擾
行動作業系統使用 CPA 微型瀏覽器來偵測和處理 Captive 網路。這些微型瀏覽器通常缺乏開啟原生應用程式的能力,這會中斷 OAuth 流程中的 WeChat 應用程式呼叫。緩解方案包括:
- 實作 JavaScript 重新導向,偵測 CPA 環境並在啟動 OAuth 流程之前開啟完整的系統瀏覽器。
- 在歡迎頁面上顯示清晰的說明,告知使用者如果 WeChat 按鈕沒有回應,請在完整的瀏覽器中開啟該頁面。
權杖過期與過期工作階段
WeChat 存取權杖(access token)將在兩小時後過期。如果您的平台未重新整理權杖,使用者的 CRM 記錄將在初始工作階段後停止更新。設定 Purple 的權杖重新整理設定,以在訪客停留期間維持作用中權杖。
地緣政治與法規風險
WeChat 受中國政府監管和騰訊的平台政策約束。API 存取權限可能會在不經通知的情況下被暫停或修改。透過確保您的 Captive Portal 支援多種驗證方法(電子郵件、簡訊、其他社群登入)來緩解此風險,如此一來,即使 WeChat API 中斷,也不會導致您的整個訪客 WiFi 離線。Purple 的多方法傳送門原生支援此備援架構。
投資報酬率 (ROI) 與商業影響
部署 WeChat WiFi 驗證可在三個面向帶來可衡量的回報。
提高資料擷取率。 社群登減少表單填寫的阻力。使用 Purple 的社群登入選項的場所報告指出,其驗證完成率比僅限電子郵件的同等入口網站高出 20-30%(Purple 內部數據,2024 年)。以每天處理 500 個訪客 WiFi 連線的場所為例,25% 的提升意味著每天能額外獲取 125 個已驗證的個人檔案。
官方帳號粉絲成長。 將已驗證的使用者重定向至官方帳號追蹤頁面,可將短暫的實體人流轉化為可觸及的數位受眾。一家每天有 200 名微信驗證訪客的飯店,若達到 40% 的追蹤率,每天就能增加 80 名新的官方帳號粉絲——這些粉絲可以接收有關再次光臨優惠、會員計劃更新和季節性促銷的精準推送通知。
營運可視性。 Purple 的 WiFi Analytics 平台可將微信驗證的階段作業對應到停留時間、造訪頻率和區域級的移動數據。這為場所營運主管提供了優化人員配置、佈局和促銷時機的數據。對於 旅宿 場所,此數據可直接與 PMS 系統整合,以豐富訪客個人檔案。
對於 零售 環境,微信驗證與 Purple 分析平台的結合,在實體店面情境中複製了電子商務的豐富數據——隨著第三方 Cookie 的淘汰降低了數位再行銷的效果,這項功能變得越來越有價值。
如需相關指引,請參閱我們的 WiFi GDPR 合規指南 和我們的 企業級 WiFi 安全指南 。若要了解 Purple 如何在特定垂直產業中部署,請參閱我們的 旅宿 、 零售 、 醫療保健 和 交通運輸 頁面。
關鍵定義
OAuth 2.0
An industry-standard authorisation protocol that allows a user to grant a third-party application access to their account data on another service without sharing their password. In WeChat WiFi authentication, the captive portal is the third-party application and WeChat is the identity provider.
The underlying mechanism for all social WiFi login. IT teams encounter it when configuring the AppID, AppSecret, and redirect URI in the WeChat developer console and the Purple platform.
Captive portal
A web page that intercepts a device's network traffic and requires the user to authenticate or accept terms before granting internet access. It operates by redirecting all HTTP requests to the portal URL until authentication is complete.
The user-facing component of the WeChat WiFi login system. Purple hosts and manages the captive portal as a cloud overlay on top of the venue's existing hardware.
Walled garden
A pre-authentication whitelist of IP addresses and domains that a device can reach before completing captive portal login. Required to allow the device to communicate with WeChat's authentication servers during the OAuth flow.
The most commonly misconfigured element in WeChat WiFi deployments. Must be configured at the SSID level on the wireless controller.
RADIUS
Remote Authentication Dial-In User Service. A networking protocol providing centralised authentication, authorisation, and accounting for network access. After a successful WeChat OAuth exchange, Purple sends a RADIUS Access-Accept message to the access point to grant internet access.
The protocol that connects the Purple identity platform to the venue's network hardware. IT teams configure RADIUS server IP addresses and shared secrets in the wireless controller.
WeChat Service Account (服务号)
A category of WeChat Official Account designed for businesses, offering full API access including OAuth 2.0 webpage authorisation. Appears as a contact in the user's chat list. Requires Chinese business registration or overseas verification.
The mandatory account type for WeChat WiFi login. Subscription accounts cannot be used for this purpose.
OpenID
A unique identifier assigned by WeChat to a specific user for a specific Official Account. Two different Official Accounts will receive different OpenIDs for the same user.
The primary key used by the CRM to identify and track individual users across WiFi sessions.
Unionid
A unique identifier assigned by WeChat to a specific user across all Official Accounts and Mini Programs registered under the same WeChat open platform account. Allows cross-product user recognition.
Relevant for brands with multiple WeChat touchpoints (e.g., a retail chain with both a WiFi portal and a shopping Mini Program) that want to unify the user profile across all interactions.
MAC address caching
A network feature that stores a device's unique hardware identifier (MAC address) after initial authentication, allowing the network to automatically grant access on subsequent connections without presenting the captive portal again.
Used to improve the return visitor experience. Purple logs the return visit for analytics even when the portal is not displayed.
Captive Portal Assistant (CPA)
The mini-browser automatically launched by iOS and Android when they detect a network requiring captive portal authentication. CPAs have limited functionality and may not support native app callouts required for the WeChat OAuth flow.
IT teams must test the WeChat login flow specifically within the CPA environment and implement JavaScript detection to redirect to the full system browser if necessary.
VLAN
Virtual Local Area Network. A logical network segment that isolates traffic from other segments on the same physical infrastructure. Used to separate guest WiFi traffic from corporate or POS networks.
RADIUS attributes returned by Purple can assign WeChat-authenticated guests to a specific VLAN, satisfying PCI DSS network segmentation requirements.
範例
A luxury retail brand in London wants to offer seamless WiFi to Chinese tourists while increasing followers on their WeChat Official Account. They currently use Cisco Meraki access points and a standard email-capture portal. Their IT team has two weeks to deploy before a major Chinese New Year campaign.
Week one: Register and verify a WeChat Service Account if not already in place (allow two to four weeks for Tencent approval, so this step should have started earlier - if not, use a verified third-party Chinese entity as an interim measure). Configure the WeChat developer console with the callback domain matching the Purple portal URL. In the Purple platform, enable WeChat social login, input the AppID and AppSecret, and design the splash page with WeChat as the primary login option. Configure the post-authentication redirect to the brand's WeChat Official Account follow page. Week two: In the Meraki dashboard, update the guest SSID to point to the Purple portal URL. Add all WeChat API domains to the Meraki walled garden under Wireless > Access Control. Set RADIUS server details. Test the full flow end-to-end from an iOS and Android device. Enable MAC caching for 30-day return visitor recognition. Go live.
A 15,000-capacity stadium is hosting a series of international events with significant Chinese-speaking attendees. The IT director reports that 35% of guests abandon the WiFi login form before completing it. The network runs HPE Aruba access points managed via Aruba Central.
Deploy Purple's captive portal with WeChat as the primary social login option alongside email and SMS fallbacks. Configure the Aruba Central captive portal profile to redirect to Purple and add WeChat domains to the allowed list. Implement a JavaScript CPA detection script on the splash page to force the OAuth flow into the native system browser, bypassing the Aruba CPA mini-browser. Configure RADIUS attributes to assign authenticated fans to a dedicated guest VLAN, isolated from the stadium's operational network. Set session timeout to four hours to cover a typical event duration without requiring re-authentication. Post-authentication, redirect fans to a WeChat Mini Program hosting the event programme, live scores, and a food ordering service.
練習題
Q1. Your venue's new WeChat WiFi login is failing. Guests tap the WeChat button on the splash page, but the page times out before the WeChat app opens. The Cisco Meraki dashboard shows the SSID is online and the Purple portal URL is correctly configured. What is the most likely cause and how do you fix it?
提示:Consider what network access the device has before it completes authentication.
查看標準答案
The walled garden on the Meraki SSID is misconfigured. The device cannot reach WeChat's API domains before authentication, so the OAuth handshake cannot initiate. Fix: navigate to Wireless > Access Control in the Meraki dashboard, locate the Walled Garden section, and add the required WeChat domains including *.weixin.qq.com, *.wechat.com, and *.wx.qq.com. Test by attempting the login flow again from a device that has not previously connected to the SSID.
Q2. A marketing director wants to use their existing WeChat Subscription Account (订阅号) to enable WiFi login because it allows daily article publishing to followers. They ask you to configure the integration. How do you respond?
提示:Review the API access levels for different WeChat account types.
查看標準答案
Advise them that a Subscription Account cannot be used for WiFi authentication. The OAuth 2.0 webpage authorisation APIs required for captive portal integration are only available to verified Service Accounts (服务号). They will need to register a Service Account. This requires a Chinese business licence or an overseas application through Tencent's special process, which takes two to four weeks and costs $99 annually. The Subscription Account can remain active for content publishing; the two account types serve different purposes and can coexist.
Q3. After a successful WeChat WiFi deployment, the IT team notices that users who authenticated three weeks ago are no longer appearing in the CRM with updated visit data, even though they are connecting to the network. What is the likely cause?
提示:Consider the session management settings configured in Purple and the MAC cache duration.
查看標準答案
The MAC cache duration is likely set to a value shorter than three weeks (e.g., 14 days), so returning users are being granted access via MAC cache without triggering a new authentication event or CRM update. Alternatively, the WeChat access token for those users has expired and the platform is not refreshing it. Fix: extend the MAC cache duration to 30 days in Purple's return visitor settings, and ensure the token refresh configuration is active. Also confirm that Purple is logging MAC-cached visits as return visit events in the analytics dashboard, even when the portal is not displayed.
Q4. Your venue operates in both the UK and mainland China. You want to deploy a unified WeChat WiFi authentication system. What compliance obligations must you address before going live?
提示:Two distinct privacy regimes apply to the two geographies.
查看標準答案
You must comply with both GDPR (applicable to users in the UK and EU) and China's Personal Information Protection Law (PIPL, applicable to users in mainland China). Key requirements include: displaying a clear privacy notice on the splash page before initiating the OAuth flow, identifying the data controller and listing the categories of data collected from WeChat, stating the legal basis for processing under each regime (legitimate interests or consent under GDPR; consent under PIPL), providing a mechanism for users to withdraw consent and request deletion, and ensuring data transfer mechanisms are in place if WeChat profile data flows between jurisdictions. Consult Purple's GDPR compliance guide and your legal counsel for jurisdiction-specific requirements.
繼續閱讀本系列
員工 WiFi Captive Portal:員工入網與驗證
針對 IT 主管設計與部署員工 WiFi Captive Portal 的全面技術參考指南。本指南涵蓋 EAP-TLS 驗證、BYOD 入網、VLAN 區隔及頻寬管理,旨在提升營運效率並降低安全風險。
如何在 Ruijie Networks 設備上設定訪客 WiFi 與 Captive Portals
本技術指南詳細介紹了在 Ruijie Networks 硬體上設定訪客 WiFi 和 Captive Portals 的步驟,涵蓋原生雲端入口網站與外部 RADIUS 整合。本指南為 IT 經理和網路架構師提供了 VLAN 隔離、Walled Garden 設定以及第三方平台整合的具體實作步驟,以推動數據分析並創造收益。
企業級 SCEP 設定指南:適用於高等教育與大型網路的憑證式 Wi-Fi 驗證
本指南提供使用 SCEP 部署憑證式 WiFi 驗證的完整技術藍圖。內容涵蓋從預共用金鑰到 EAP-TLS 的架架構轉移、跨 MDM 平台的部署順序,以及大型網路的關鍵風險緩釋策略。