Skip to main content

Integrating WeChat Authentication with Guest WiFi Captive Portals

This guide explains how to integrate WeChat OAuth 2.0 authentication into enterprise guest WiFi captive portals. It covers the dual-platform registration requirements, scope selection for first-party data capture, network enforcement via RADIUS Change of Authorisation, and compliance with GDPR and China's PIPL. Venue operators in hospitality, retail, and events will find concrete implementation steps, real-world case studies, and security hardening guidance to deploy WeChat login guest wifi at scale.

📖 8 min read📝 1,966 words🔧 2 worked examples4 practice questions📚 9 key definitions

Listen to this guide

View podcast transcript
HOW TO CONFIGURE WECHAT OAUTH AUTHENTICATION FOR CAPTIVE PORTALS A Purple Technical Briefing - Approximately 10 Minutes --- INTRODUCTION AND CONTEXT (approximately 1 minute) Welcome. If you are responsible for guest WiFi at a hotel, retail chain, stadium, or conference centre that serves Chinese visitors, this briefing is for you. WeChat has 1.38 billion monthly active users, according to Tencent's 2024 data. The overwhelming majority are in China, but the platform has a meaningful international footprint too - four million users in the United States, 12 million in Malaysia, and growing numbers across Southeast Asia, Europe, and the Middle East. When a Chinese guest connects to your WiFi and sees a login page with only email, Facebook, or a voucher code, they face immediate friction. They may not have a local email address set up on that device. They almost certainly have WeChat. So the question is not whether you should offer WeChat login - it is how you configure it correctly, securely, and in a way that generates first-party data you can actually use. That is what we are going to cover today. We will walk through the OAuth 2.0 flow, the two platform registrations you need, the scope decision that determines what data you collect, the network-side enforcement mechanism, and the compliance considerations that matter in 2026. --- TECHNICAL DEEP-DIVE (approximately 5 minutes) Let us start with the architecture. A captive portal intercepts HTTP traffic from an unauthenticated device and redirects it to a login page. That login page is hosted on a portal server - either on-premises or in the cloud. When you add WeChat OAuth, you are inserting a third-party identity provider into that flow. Here is the sequence. The guest connects to your SSID. The access point or wireless controller detects that the device has no authenticated session and redirects all HTTP traffic to your captive portal URL. The portal page loads and presents login options - including WeChat. The guest taps WeChat login. Your portal server redirects the browser to WeChat's authorisation endpoint, passing your App ID, the redirect URI, the response type of code, and the scope. WeChat handles the authentication entirely on its own servers. If the guest is already logged into WeChat in their browser, they see a consent screen. If they are using the WeChat in-app browser, the experience can be silent with the snsapi base scope - no consent prompt at all. WeChat then redirects back to your portal's redirect URI with a temporary authorisation code. Your portal server exchanges that code for an access token, passing your App ID, App Secret, the code, and grant type of authorisation code. WeChat returns an access token, a refresh token, the user's Open ID, and the scope granted. If you requested snsapi userinfo scope, you can then make a second API call to retrieve the user's nickname, avatar, gender, and city. Now, the two platform registrations. This is where most implementations go wrong. WeChat has two separate developer platforms. The WeChat Open Platform handles website applications and mobile apps. The WeChat Official Accounts Platform handles public accounts - what most venues actually need. For a captive portal serving guests inside the WeChat in-app browser, you need a Service Account on the Official Accounts Platform. A Subscription Account will not work - it does not have OAuth web page authorisation permissions. A Service Account does, and it supports both snsapi base and snsapi userinfo scopes. For a captive portal accessed from a standard mobile browser outside WeChat - Chrome on Android, Safari on iOS - you need a Website Application registered on the Open Platform. This uses snsapi login scope and presents a QR code that the user scans with their WeChat app. In practice, most venue deployments use both. A guest on a hotel's WiFi might open the portal in Chrome, see a QR code, scan it with WeChat, and authenticate. Or they might follow a link in WeChat itself, land in the in-app browser, and authenticate silently with snsapi base. Let us talk about scope selection, because this is a genuine decision point. snsapi base returns only the Open ID - a unique identifier for that user within your Official Account. It requires no user consent prompt. The authentication is invisible to the user. This is ideal for returning guests you have already profiled, or for venues where you want zero friction. snsapi userinfo returns the Open ID plus the user's WeChat nickname, profile picture, gender, language setting, and city. It requires an explicit consent screen. Most users accept, but there is friction. The right choice depends on your use case. For a first-time guest registration where you want to build a profile, use snsapi userinfo and pair it with a GDPR-compliant consent layer on your portal page. For a returning guest who has already consented and whose profile you already hold, use snsapi base for silent re-authentication. Now, the network enforcement side. Getting an OAuth token proves identity, but it does not automatically open the network. You need a mechanism to translate a successful authentication into network access. The two standard approaches are RADIUS Change of Authorisation, defined in RFC 3576, and MAC address bypass. With RADIUS CoA, your portal server sends a CoA request to the network controller after successful OAuth, and the controller moves the device from the unauthenticated VLAN to the guest VLAN. This works with Cisco Meraki, HPE Aruba, Ruckus, Juniper Mist, and most enterprise-grade controllers. With MAC bypass, the portal server registers the device's MAC address as an authorised client, and the controller allows it. MAC bypass is simpler to implement but less secure, because MAC addresses can be spoofed. Purple's Guest WiFi platform handles both mechanisms. After WeChat OAuth completes, Purple's cloud overlay sends the appropriate signal to the underlying hardware - whether that is Cisco Meraki, HPE Aruba, Ruckus, Juniper Mist, Ubiquiti UniFi, Cambium, Extreme, or Fortinet. The venue operator does not need to manage that translation manually. --- IMPLEMENTATION RECOMMENDATIONS AND PITFALLS (approximately 2 minutes) Let me give you the five things that cause WeChat OAuth captive portal implementations to fail. First: the redirect URI mismatch. WeChat validates the redirect URI against the authorised domain you registered on the platform. If your portal server uses a different subdomain, a different path, or HTTP instead of HTTPS, the OAuth flow fails with error 40029 - invalid code. Register every domain variant you use, including staging environments. Second: the App Secret on the client side. Your App Secret must never appear in client-side JavaScript. It belongs on your server. If it is exposed, anyone can impersonate your application and call WeChat's APIs on your behalf. Third: missing CSRF protection. The state parameter in the OAuth request exists specifically to prevent cross-site request forgery. Generate a cryptographically random state value, store it in the user's session, and validate it when WeChat redirects back. Skip this and you have a real vulnerability. Fourth: the in-app browser detection gap. WeChat's in-app browser sets a specific user agent string containing MicroMessenger. If your portal does not detect this and serve the correct OAuth flow, users get a broken experience or an error. Fifth: GDPR and PIPL alignment. If you serve European visitors, GDPR applies. If you serve Chinese visitors, China's Personal Information Protection Law - PIPL - applies. Both require a lawful basis for processing, clear purpose limitation, and data minimisation. snsapi base is easier to justify under data minimisation principles than snsapi userinfo. Whatever you collect, document your legal basis and your retention period. --- RAPID-FIRE Q AND A (approximately 1 minute) Can I use WeChat login on a portal that also offers email and SMS login? Yes. Most enterprise portal platforms, including Purple, support multiple authentication methods on the same portal page. Does WeChat OAuth work on iOS? Yes. WeChat login in Safari on iOS works via the QR code flow or redirect flow. The WeChat app itself handles the authentication. What happens if WeChat's API is unavailable? Implement a fallback. If the WeChat API call times out or returns an error, redirect the user to an alternative login method. Can I use the Open ID as a persistent customer identifier? Within your Official Account, yes. For cross-account identity resolution across multiple properties, use the UnionID instead. --- SUMMARY AND NEXT STEPS (approximately 1 minute) To summarise. WeChat OAuth authentication for captive portals is a two-platform registration exercise, a scope decision, a network enforcement integration, and a compliance review. Get those four things right and you have a login method that serves over a billion potential visitors with zero password friction. The practical next steps: determine whether your visitors encounter the portal inside the WeChat in-app browser or in a standard mobile browser. Decide on scope - snsapi base for returning guests, snsapi userinfo for first-time registration with consent. Confirm your network hardware supports RADIUS CoA. Review your privacy notice against GDPR and PIPL. Test the redirect URI, the state parameter validation, and the in-app browser detection before you go live. If you want to see how Purple handles WeChat OAuth as part of a broader Guest WiFi and analytics platform - across 80,000 venues and 440 million logins in 2024 - visit purple.ai or speak to your account team. Thanks for listening. --- END OF SCRIPT

header_image.png

Executive summary

When a Chinese visitor connects to your enterprise network and encounters a captive portal offering only email, Facebook, or a voucher code, you introduce immediate friction. WeChat has 1.38 billion monthly active users, according to Tencent's 2024 data. Integrating WeChat login guest wifi capabilities is not a hospitality convenience - it is a technical requirement for capturing first-party data from this demographic without friction.

This guide details the technical architecture for integrating WeChat OAuth 2.0 authentication into captive portals. It explains the dual-platform registration required to support both standard mobile browsers and the WeChat in-app browser, evaluates the trade-offs between the snsapi_base and snsapi_userinfo scopes for data collection, and outlines how to enforce network access using RADIUS Change of Authorisation (CoA) or MAC authentication bypass. It also covers the security configurations and compliance mandates - GDPR and China's PIPL - required to deploy this at scale across Cisco Meraki, HPE Aruba, Ruckus, Juniper Mist, Ubiquiti UniFi, Cambium, Extreme, and Fortinet infrastructure.


Technical deep-dive: WeChat OAuth 2.0 architecture

A captive portal intercepts HTTP traffic from an unauthenticated device and redirects it to a login page hosted on a portal server. Adding WeChat authentication inserts a third-party identity provider into this flow using the OAuth 2.0 protocol - the same standard used by Google, Microsoft Entra ID, and Okta for federated identity.

oauth_flow_diagram.png

The authentication sequence operates as follows. The guest connects to the SSID. The access point or wireless controller detects the unauthenticated session and redirects HTTP traffic to the captive portal URL. The guest selects WeChat login on the portal page. The portal server redirects the browser to WeChat's authorisation endpoint at open.weixin.qq.com, passing the AppID, the redirect URI, the response type of code, and the requested scope. WeChat handles authentication on its own servers. If the guest uses the WeChat in-app browser with the snsapi_base scope, authentication is silent - no consent prompt appears. If using snsapi_userinfo, WeChat presents a consent screen. WeChat then redirects back to the portal's redirect URI with a temporary authorisation code. The portal server exchanges this code for an access token by calling api.weixin.qq.com/sns/oauth2/access_token, passing the AppID, AppSecret, the code, and a grant type of authorization_code. WeChat returns an access token, a refresh token, the user's OpenID, and the granted scope. If snsapi_userinfo was granted, the server makes a second API call to retrieve the user's nickname, avatar, gender, and city.

The dual-platform registration requirement

Most implementations fail at the registration stage. WeChat operates two separate developer platforms, and enterprise deployments typically require both.

Platform URL Account type required Scope supported Browser context
Official Accounts Platform mp.weixin.qq.com Service Account snsapi_base, snsapi_userinfo WeChat in-app browser
Open Platform open.weixin.qq.com Website Application snsapi_login Standard mobile browser

For guests accessing the portal inside the WeChat in-app browser, you need a Service Account on the Official Accounts Platform. A Subscription Account will not work - it lacks OAuth web page authorisation permissions. For guests accessing the portal from Chrome on Android or Safari on iOS, you need a Website Application on the Open Platform, which uses snsapi_login scope and presents a QR code for the user to scan.

In practice, most venue deployments use both. A guest at a hotel might open the portal in Chrome, see a QR code, scan it with WeChat, and authenticate. Or they might follow a link in WeChat itself, land in the in-app browser, and authenticate silently with snsapi_base.

Scope selection: data capture vs. friction

scope_comparison.png

The scope you request determines what data you collect and the friction the guest experiences. This is a genuine decision point with compliance implications.

snsapi_base returns only the OpenID - a unique identifier for that user within your Official Account. It requires no user consent prompt. Authentication is invisible to the guest. Use this for returning guests whose profiles you already hold, or when you prioritise frictionless access. Under GDPR and PIPL data minimisation principles, snsapi_base is easier to justify.

snsapi_userinfo returns the OpenID plus the user's nickname, profile picture, gender, and city. It requires an explicit consent screen. Use this for first-time guest registration where you need to build a profile, paired with a compliant consent layer on your portal page.

UnionID for multi-property deployments

The OpenID is unique to the combination of a user and a specific Official Account. A hotel group with 20 properties, each with its own Official Account, will see 20 different OpenIDs for the same guest. The UnionID solves this. It is a single identifier representing a user across all Official Accounts and apps linked to the same Open Platform account. Link your Official Accounts to your Open Platform account, and the UnionID is returned in the OAuth response. This is the foundation of cross-property guest recognition.


Implementation guide

Network enforcement mechanisms

Getting an OAuth token proves identity. It does not open the network. You must signal the controller to permit traffic.

RADIUS Change of Authorisation (CoA), defined in RFC 3576, is the recommended enterprise approach. After successful OAuth, the portal server sends a CoA request to the network controller. The controller moves the device from the pre-authentication VLAN to the guest VLAN. This works with Cisco Meraki, HPE Aruba, Ruckus, Juniper Mist, Ubiquiti UniFi, Cambium, Extreme, and Fortinet.

MAC Authentication Bypass (MAB) registers the device's MAC address as an authorised client in the RADIUS database. The controller permits access based on that MAC. MAB is simpler to implement but unreliable: modern iOS and Android devices randomise MAC addresses by default, breaking the session association on reconnect.

Purple's Guest WiFi platform automates this translation. After WeChat OAuth completes, Purple's cloud overlay sends the appropriate CoA or MAB signal to the underlying hardware, eliminating manual VLAN configuration.

Security configuration

Three configurations are non-negotiable.

  1. Protect the AppSecret. The AppSecret must never appear in client-side JavaScript. It must remain on your server. If exposed, attackers can impersonate your application and call WeChat APIs on your behalf.
  2. Implement CSRF protection. Generate a cryptographically random state value, store it in the user's session, and validate it when WeChat redirects back. This prevents cross-site request forgery attacks as defined in RFC 6749.
  3. Register all redirect URI variants. WeChat validates the redirect URI against your registered domain. Register every subdomain and path variant you use, including staging environments, to prevent error 40029 (invalid code).

In-app browser detection

WeChat's in-app browser sets a user agent string containing MicroMessenger. Your portal must detect this string and route accordingly: Official Account flow for in-app browser, Open Platform QR code flow for standard browsers. Failing to detect this produces broken experiences or authentication errors.

hotel_wechat_wifi.png


Best practices and compliance

GDPR compliance

If you serve European visitors or operate in Europe, GDPR applies to the data you collect via WeChat OAuth. You must establish a lawful basis for processing - typically consent or legitimate interests. You must provide a clear privacy notice on the captive portal before authentication. You must honour subject access requests and deletion requests. For a detailed compliance framework, see The Compliance Playbook: GDPR and Guest WiFi Data Privacy .

PIPL compliance

China's Personal Information Protection Law applies when you process the personal data of Chinese citizens. Like GDPR, PIPL requires clear purpose limitation, data minimisation, and a documented lawful basis. snsapi_base is easier to justify under data minimisation than snsapi_userinfo. Whatever you collect, document your legal basis and retention period before go-live.

Network segmentation

Isolate guest WiFi traffic from your corporate network using VLAN segmentation. Guests authenticated via WeChat should land in a dedicated guest VLAN with internet access only - no access to internal systems. This aligns with PCI DSS requirements for cardholder data environment isolation and general enterprise security practice. For more on segmentation architecture, see Bandwidth Management: A Practical Guide for 2026 .

Fallback authentication

If WeChat's API is unavailable, your portal must redirect to an alternative login method. Do not leave guests with a blank screen. A fallback to email or SMS ensures continuity. This is particularly important for venues in Transport and Healthcare environments where connectivity is a service obligation.


Real-world case studies

Hospitality: luxury hotel group

A 400-room luxury hotel in London serves a significant proportion of guests from mainland China. Their existing captive portal required an email address and SMS verification. Chinese mobile numbers frequently fail to receive SMS from European providers, and many guests do not have a local email configured on their device. The result was a 60% drop-off rate at the portal.

The hotel registered a Service Account on the Official Accounts Platform and a Website Application on the Open Platform. The portal detects the MicroMessenger user agent and triggers snsapi_base for in-app browser users - connecting them in under three seconds with no consent screen. Guests arriving via Chrome or Safari see a QR code. On subsequent stays, the same OpenID is recognised and the guest is re-authenticated silently. The hotel's CRM logs the return visit, enabling targeted pre-arrival communications. For more on deploying WiFi in hospitality environments, see Hospitality .

Retail: shopping mall analytics

A large retail mall wants to capture demographic data from Chinese shoppers to inform tenant mix and marketing decisions. They need city of origin, gender, and visit frequency. snsapi_base is insufficient - they need snsapi_userinfo. The portal requests the full userinfo scope. The guest sees a WeChat consent screen and taps Allow. The mall's analytics platform, integrated with Purple's WiFi Analytics , receives a stream of verified demographic data. On Saturday afternoons, 40% of WiFi users originate from a specific region. That data directly informs which brands to approach for pop-up events. For more on retail WiFi deployments, see Retail .


Troubleshooting and risk mitigation

The five most common failure modes in WeChat OAuth captive portal deployments are as follows.

Redirect URI mismatch (error 40029). WeChat validates the redirect URI against the registered domain. Any subdomain, path, or protocol mismatch fails the code exchange. Register every variant, including staging environments.

AppSecret exposure. Embedding the AppSecret in client-side code is the single most serious security error. Move all token exchange logic to the server.

Missing CSRF protection. Omitting the state parameter validation leaves the portal vulnerable to cross-site request forgery. Generate a cryptographically random value per session and validate it on callback.

In-app browser detection failure. Not detecting MicroMessenger in the user agent means in-app browser users are served the wrong OAuth flow, producing errors.

MAC address randomisation breaking MAB sessions. Modern mobile operating systems randomise MAC addresses. Guests using MAB-based enforcement will lose their session on reconnect. Upgrade to RADIUS CoA for reliable session management. For guidance on secure WiFi configuration, see What Is Secure WiFi: Essential Guide for Business 2026 .


ROI and business impact

Deploying WeChat login guest WiFi functionality has three measurable impacts.

Increased authentication rates. Removing the SMS verification failure point and the email entry requirement increases the percentage of Chinese visitors who successfully connect. A 60% drop-off rate is a realistic baseline for portals without WeChat support.

First-party data quality. WeChat-authenticated profiles include a verified OpenID and, with snsapi_userinfo, demographic attributes sourced directly from the social platform. This data feeds into analytics platforms to drive targeted marketing without reliance on third-party cookies.

Reduced support overhead. Frictionless login reduces front-desk and IT support calls from international guests troubleshooting connection issues.

Purple operates across 80,000+ venues and processed 440 million logins in 2024 (Purple internal data). The platform is ISO 27001 certified, GDPR and CCPA compliant, and maintains 99.999% uptime. For venues in Retail and Hospitality , WeChat authentication transforms the network from a cost centre into a reliable first-party data acquisition channel.

Key Definitions

Captive portal

A web page that intercepts HTTP traffic from an unauthenticated device and requires the user to interact with it before network access is granted.

The primary interface where the WeChat login option is presented to the guest. The portal server hosts this page and orchestrates the OAuth flow.

OAuth 2.0

An industry-standard authorisation protocol (RFC 6749) that allows a third-party application to obtain limited access to an HTTP service on behalf of a user.

The underlying protocol WeChat uses to pass authentication tokens to the portal server without exposing user credentials. The same protocol used by Microsoft Entra ID, Okta, and Google Workspace.

OpenID

A unique alphanumeric identifier assigned to a specific WeChat user for a specific Official Account.

Used as the primary key to identify returning guests in the WiFi analytics database. Changes per Official Account - use UnionID for cross-property recognition.

UnionID

A single WeChat identifier representing a user across all Official Accounts and apps linked to the same Open Platform account.

Essential for hotel groups, retail chains, and stadium operators with multiple venues who need to recognise the same guest across their entire estate.

RADIUS CoA (Change of Authorization)

An extension to the RADIUS protocol (RFC 3576) that allows a RADIUS server to dynamically change the authorisation attributes of an active session.

The secure method used to move a guest device from an isolated pre-authentication VLAN to the active internet VLAN after successful WeChat login. Supported by Cisco Meraki, HPE Aruba, Ruckus, Juniper Mist, Ubiquiti UniFi, Cambium, Extreme, and Fortinet.

snsapi_base

A WeChat OAuth scope that returns only the user's OpenID and requires no consent prompt from the user.

The recommended scope for returning guest re-authentication. Easier to justify under GDPR and PIPL data minimisation principles.

snsapi_userinfo

A WeChat OAuth scope that returns the user's OpenID, nickname, avatar, gender, and city, and requires an explicit consent screen.

Used for first-time guest registration where demographic data is required for analytics. Requires documented lawful basis under GDPR and PIPL.

PIPL (Personal Information Protection Law)

China's comprehensive data privacy legislation, effective November 2021, regulating the processing of personal information of natural persons located in China.

Applies when venues process data from Chinese citizens via WeChat OAuth. Requires clear consent, purpose limitation, data minimisation, and a deletion mechanism.

AppSecret

A confidential cryptographic key issued by WeChat during application registration, used to authenticate API calls from the portal server.

Must be stored exclusively on the server side. Exposure in client-side JavaScript allows attackers to impersonate the application and call WeChat APIs maliciously.

Worked Examples

A 400-room luxury hotel in London has a 60% portal drop-off rate among guests from mainland China. The current portal requires email and SMS verification. The IT Director needs to implement WeChat authentication while maintaining GDPR compliance and network security.

Step 1: Register a Service Account on the WeChat Official Accounts Platform (mp.weixin.qq.com) and a Website Application on the WeChat Open Platform (open.weixin.qq.com). Step 2: Configure the portal to detect the MicroMessenger user agent string. If detected, trigger the snsapi_base OAuth flow for silent authentication. If not detected, present the QR code flow. Step 3: Add a GDPR-compliant privacy notice and consent checkbox to the portal page before the WeChat login button becomes active. The notice must state: data collected (OpenID only), purpose (guest WiFi access and return visit recognition), and retention period. Step 4: After successful OAuth token exchange, the portal server issues a RADIUS CoA request to the Cisco Meraki controller, moving the guest device from the pre-auth VLAN to the segmented guest VLAN. Step 5: Store the OpenID against the device MAC address in the guest database. On subsequent visits, the returning OpenID triggers silent re-authentication.

Examiner's Commentary: This approach correctly addresses both the technical and compliance requirements. Using snsapi_base aligns with GDPR data minimisation principles, reducing legal risk while eliminating the SMS verification failure point. RADIUS CoA ensures secure, automated network segmentation. The consent checkbox satisfies the GDPR requirement for a documented lawful basis. The key decision is snsapi_base over snsapi_userinfo - the hotel does not need demographic data for this use case, so collecting it would introduce unnecessary compliance obligations.

A retail mall wants to capture gender and city data from Chinese shoppers via guest WiFi to feed into their analytics platform. They currently use MAC Authentication Bypass for their existing portal running on HPE Aruba hardware.

Step 1: Register a Service Account on the WeChat Official Accounts Platform. Step 2: Configure the portal to use snsapi_userinfo scope to retrieve gender and city. Step 3: Add a clear consent screen explaining the value exchange: free WiFi in return for profile data access. The consent must be explicit and granular under both GDPR and PIPL. Step 4: After authentication, the portal server registers the device's MAC address in the RADIUS database. The HPE Aruba controller permits access via MAB. Step 5: Document the lawful basis (consent), purpose (venue analytics and marketing), and retention period (24 months) in a data processing register. Provide a data deletion mechanism.

Examiner's Commentary: The snsapi_userinfo scope correctly retrieves the required demographic data. However, relying on MAB introduces a significant operational risk: iOS 14+ and Android 10+ randomise MAC addresses by default, meaning guests will lose their authenticated session on reconnect and be forced to re-authenticate. The mall should plan to migrate to RADIUS CoA on HPE Aruba to resolve this. The PIPL compliance documentation is not optional - it is a legal requirement for processing data from Chinese citizens, regardless of where the venue is located.

Practice Questions

Q1. You are deploying a captive portal at a stadium. You want returning season ticket holders who have previously authenticated to connect automatically without seeing a login screen on subsequent visits. Which WeChat OAuth scope should you implement for the re-authentication flow, and why?

Hint: Consider which scope allows for silent authentication without prompting the user for consent on each visit.

View model answer

Use snsapi_base. This scope returns only the user's OpenID and requires no consent prompt, enabling silent re-authentication. On the first visit, you store the OpenID against the fan's profile. On subsequent visits, the portal detects the returning OpenID via snsapi_base, confirms the match, and issues a RADIUS CoA to grant access - all without the fan seeing a login screen. This also aligns with GDPR data minimisation principles, as you are not collecting additional data beyond what is needed for the authentication function.

Q2. During testing, your portal successfully redirects to WeChat, the user grants consent, and WeChat redirects back to your portal. However, the portal server logs show OAuth error 40029 (invalid code). What is the most likely configuration error, and how do you resolve it?

Hint: WeChat strictly validates the destination it sends the authorisation code to against a registered list.

View model answer

The most likely cause is a redirect URI mismatch. WeChat validates the redirect URI in the OAuth request against the authorised domain registered on the platform. If the portal server uses a different subdomain, a different path, or HTTP instead of HTTPS, the code exchange fails with error 40029. Resolution: log into the WeChat developer platform, navigate to your Service Account or Website Application settings, and add every redirect URI variant you use - including staging subdomains, different paths, and HTTPS versions. Ensure the redirect_uri parameter in your OAuth request exactly matches one of the registered URIs, including URL encoding.

Q3. An IT manager proposes embedding the WeChat AppSecret in the captive portal's front-end JavaScript to speed up the token exchange process directly from the client browser. Why must you reject this proposal, and what is the correct architecture?

Hint: Consider the security implications of exposing cryptographic keys in publicly accessible code.

View model answer

Reject this proposal. The AppSecret is a confidential cryptographic key. Embedding it in client-side JavaScript exposes it to anyone who views the page source or intercepts network traffic. An attacker can extract the AppSecret and impersonate the application, calling WeChat APIs on the venue's behalf, accessing user data, and potentially compromising the entire Official Account. The correct architecture: the client-side portal page receives the authorisation code from WeChat and forwards it to the portal server via a server-side API call. The portal server holds the AppSecret in a secure environment variable and performs the token exchange with WeChat's API. The AppSecret never leaves the server.

Q4. A hotel group with 15 properties across Europe wants to build a unified guest profile that recognises when the same Chinese guest stays at different properties. Each property has its own WeChat Official Account. What WeChat identifier should they use, and what configuration is required?

Hint: The OpenID is account-specific. There is a different identifier designed for cross-account recognition.

View model answer

Use the UnionID. The OpenID changes per Official Account, so the same guest will have 15 different OpenIDs across 15 accounts. The UnionID is a stable identifier representing a user across all Official Accounts and apps linked to the same Open Platform account. Configuration required: link all 15 Official Accounts to a single WeChat Open Platform account. Once linked, the UnionID is returned in the OAuth response when the user has authorised at least one of the linked accounts. Use the UnionID as the primary key in the guest CRM to build cross-property profiles and recognise returning guests regardless of which property they visit.

Integrating WeChat Authentication with Guest WiFi Captive Portals | Technical Guides | Purple