Saltar al contenido principal

Integración de la autenticación de WeChat con Captive Portals de WiFi para invitados

Esta guía explica cómo integrar la autenticación OAuth 2.0 de WeChat en Captive Portals de WiFi para invitados empresariales. Cubre los requisitos de registro en doble plataforma, la selección de alcance (scope) para la captura de datos de primera mano, la aplicación de políticas de red a través de RADIUS Change of Authorization y el cumplimiento de GDPR y la PIPL de China. Los operadores de recintos en los sectores de hostelería, retail y eventos encontrarán pasos de implementación concretos, casos de estudio reales y directrices de endurecimiento de seguridad para desplegar el inicio de sesión de WeChat en WiFi para invitados a escala.

📖 8 min de lectura📝 1,966 palabras🔧 2 ejemplos prácticos4 preguntas de práctica📚 9 definiciones clave

Escuchar esta guía

Ver transcripción del podcast
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

Resumen ejecutivo

Cuando un visitante chino se conecta a su red empresarial y se encuentra con un Captive Portal que solo ofrece correo electrónico, Facebook o un código de cupón, se introduce una fricción inmediata. WeChat cuenta con 1380 millones de usuarios activos mensuales, según los datos de Tencent de 2024. Integrar capacidades de inicio de sesión de WeChat en WiFi para invitados no es una comodidad de hostelería: es un requisito técnico para capturar datos de primera mano de este grupo demográfico sin fricciones.

Esta guía detalla la arquitectura técnica para integrar la autenticación OAuth 2.0 de WeChat en Captive Portals. Explica el registro en doble plataforma necesario para admitir tanto los navegadores móviles estándar como el navegador integrado de WeChat, evalúa las ventajas y desventajas entre los alcances (scopes) snsapi_base y snsapi_userinfo para la recopilación de datos, y describe cómo aplicar el acceso a la red mediante RADIUS Change of Authorization (CoA) o la omisión de autenticación MAC (MAC authentication bypass). También cubre las configuraciones de seguridad y los mandatos de cumplimiento (GDPR y la PIPL de China) necesarios para desplegar esto a escala en infraestructuras de Cisco Meraki, HPE Aruba, Ruckus, Juniper Mist, Ubiquiti UniFi, Cambium, Extreme y Fortinet infrastructure.


Análisis técnico profundo: arquitectura de WeChat OAuth 2.0

Un Captive Portal intercepta el tráfico HTTP de un dispositivo no autenticado y lo redirige a una página de inicio de sesión alojada en un servidor de portal. Añadir la autenticación de WeChat inserta un proveedor de identidad de terceros en este flujo utilizando el protocolo OAuth 2.0, el mismo estándar utilizado por Google, Microsoft Entra ID y Okta para la identidad federada.

oauth_flow_diagram.png

La secuencia de autenticación funciona de la siguiente manera. El invitado se conecta al SSID. El punto de acceso o controlador inalámbrico detecta la sesión no autenticada y redirige el tráfico HTTP a la URL del Captive Portal. El invitado selecciona el inicio de sesión de WeChat en la página del portal. El servidor del portal redirige el navegador al endpoint de autorización de WeChat en open.weixin.qq.com, pasando el AppID, la URI de redirección, el tipo de respuesta code y el alcance (scope) solicitado. WeChat gestiona la autenticación en sus propios servidores. Si el invitado utiliza el navegador integrado de WeChat con el alcance snsapi_base, la autenticación es silenciosa (no aparece ninguna solicitud de consentimiento). Si utiliza snsapi_userinfo, WeChat presenta una pantalla de consentimiento. A continuación, WeChat redirige de nuevo a la URI de redirección del portal con un código de autorización temporal. El servidor del portal intercambia este código por un token de acceso llamando a api.weixin.qq.com/sns/oauth2/access_token, pasando el AppID, el AppSecret, el código y un tipo de concesión (grant type) de authorization_code. WeChat devuelve un token de acceso, un token de actualización, el OpenID del usuario y el alcance concedido. Si se concedió snsapi_userinfo, el servidor realiza una segunda llamada a la API para recuperar el apodo, el avatar, el género y la ciudad del usuario.

El requisito de registro en doble plataforma

La mayoría de las implementaciones fallan en la fase de registro. WeChat opera dos plataformas de desarrollo independientes y los despliegues empresariales suelen requerir ambas.

Plataforma URL Tipo de cuenta requerido Alcance (scope) admitido Contexto del navegador
Plataforma de Cuentas Oficiales mp.weixin.qq.com Cuenta de servicio snsapi_base, snsapi_userinfo Navegador integrado de WeChat
Plataforma abierta open.weixin.qq.com Aplicación web snsapi_login Navegador móvil estándar

Para los invitados que acceden al portal dentro del navegador integrado de WeChat, se necesita una Cuenta de servicio en la Plataforma de Cuentas Oficiales. Una Cuenta de suscripción no funcionará, ya que carece de permisos de autorización de páginas web OAuth. Para los invitados que acceden al portal desde Chrome en Android o Safari en iOS, se necesita una Aplicación web en la Plataforma abierta, que utiliza el alcance snsapi_login y presenta un código QR para que el usuario lo escanee.

En la práctica, la mayoría de los despliegues en recintos utilizan ambos. Un invitado en un hotel podría abrir el portal en Chrome, ver un código QR, escanearlo con WeChat y autenticarse. O bien, podría seguir un enlace dentro de la propia aplicación de WeChat, aterrizar en el navegador integrado y autenticarse silenciosamente con snsapi_base.

Selección de alcance (scope): captura de datos frente a fricción

scope_comparison.png

El alcance (scope) que solicite determina qué datos recopila y la fricción que experimenta el invitado. Este es un punto de decisión real con implicaciones de cumplimiento.

snsapi_base devuelve solo el OpenID: un identificador único para ese usuario dentro de su Cuenta oficial. No requiere ninguna solicitud de consentimiento del usuario. La autenticación es invisible para el invitado. Utilice esto para invitados recurrentes cuyos perfiles ya posea, o cuando priorice un acceso sin fricciones. Bajo los principios de minimización de datos de GDPR y PIPL, snsapi_base es más fácil de justificar.

snsapi_userinfo devuelve el OpenID más el apodo, la foto de perfil, el género y la ciudad del usuario. Requiere una pantalla de consentimiento explícita. Utilice esto para el registro de invitados por primera vez cuando necesite crear un perfil, combinado con una capa de consentimiento conforme a la normativa en la página de su portal.

UnionID para despliegues multipropiedad

El OpenID es único para la combinación de un usuario y una Cuenta oficial específica. Un grupo hotelero con 20 propiedades, cada una con su propia Cuenta oficial, verá 20 OpenID diferentes para el mismo invitado. El UnionID resuelve esto. Es un identificador único que representa a un usuario en todas las Cuentas oficiales y aplicaciones vinculadas a la misma cuenta de la Plataforma abierta. Vincule sus Cuentas oficiales a su cuenta de la Plataforma abierta y el UnionID se devolverá en la respuesta de OAuth. Esta es la base de la crreconocimiento de huéspedes de oss-property.


Guía de implementación

Mecanismos de aplicación de red

La obtención de un token OAuth demuestra la identidad. No abre la red. Debe enviar una señal al controlador para permitir el tráfico.

RADIUS Change of Authorization (CoA), definido en RFC 3576, es el enfoque empresarial recomendado. Tras un OAuth correcto, el servidor del portal envía una solicitud CoA al controlador de red. El controlador mueve el dispositivo de la VLAN de preautenticación a la VLAN de invitados. Esto funciona con Cisco Meraki, HPE Aruba, Ruckus, Juniper Mist, Ubiquiti UniFi, Cambium, Extreme y Fortinet.

MAC Authentication Bypass (MAB) registra la dirección MAC del dispositivo como un cliente autorizado en la base de datos RADIUS. El controlador permite el acceso basándose en esa MAC. MAB es más sencillo de implementar pero poco fiable: los dispositivos iOS y Android modernos aleatorizan las direcciones MAC de forma predeterminada, lo que rompe la asociación de la sesión al volver a conectarse.

La plataforma Guest WiFi de Purple automatiza esta traducción. Una vez completado el OAuth de WeChat, la capa en la nube de Purple envía la señal CoA o MAB adecuada al hardware subyacente, eliminando la configuración manual de la VLAN.

Configuración de seguridad

Tres configuraciones son innegociables.

  1. Proteger el AppSecret. El AppSecret nunca debe aparecer en el JavaScript del lado del cliente. Debe permanecer en su servidor. Si se expone, los atacantes pueden suplantar su aplicación y realizar llamadas a las API de WeChat en su nombre.
  2. Implementar protección CSRF. Genere un valor state criptográficamente aleatorio, almacénelo en la sesión del usuario y valídelo cuando WeChat redirija de vuelta. Esto evita los ataques de falsificación de solicitudes en sitios cruzados (CSRF) según lo definido en RFC 6749.
  3. Registrar todas las variantes de URI de redirección. WeChat valida la URI de redirección con su dominio registrado. Registre cada subdominio y variante de ruta que utilice, incluidos los entornos de prueba (staging), para evitar el error 40029 (código no válido).

Detección de navegadores integrados en la aplicación

El navegador integrado en la aplicación de WeChat establece una cadena de agente de usuario que contiene MicroMessenger. Su portal debe detectar esta cadena y redirigir en consecuencia: flujo de Cuenta Oficial para el navegador integrado en la aplicación, flujo de código QR de Plataforma Abierta para navegadores estándar. No detectar esto produce experiencias de usuario defectuosas o errores de autenticación.

hotel_wechat_wifi.png


Buenas prácticas y cumplimiento normativo

Cumplimiento de GDPR

Si ofrece servicios a visitantes europeos u opera en Europa, el GDPR se aplica a los datos que recopila a través de WeChat OAuth. Debe establecer una base legal para el tratamiento, normalmente el consentimiento o el interés legítimo. Debe proporcionar un aviso de privacidad claro en el Captive Portal antes de la autenticación. Debe atender las solicitudes de acceso y de supresión de los interesados. Para obtener un marco de cumplimiento detallado, consulte El manual de cumplimiento: GDPR y privacidad de datos de Guest WiFi .

Cumplimiento de PIPL

La Ley de Protección de Información Personal de China (PIPL) se aplica cuando se procesan datos personales de ciudadanos chinos. Al igual que el GDPR, la PIPL exige una limitación clara de la finalidad, la minimización de datos y una base legal documentada. snsapi_base es más fácil de justificar bajo la minimización de datos que snsapi_userinfo. Independientemente de lo que recopile, documente su base legal y el periodo de retención antes del lanzamiento.

Segmentación de red

Aísle el tráfico de WiFi de invitados de su red corporativa mediante la segmentación de VLAN. Los invitados autenticados a través de WeChat deben dirigirse a una VLAN de invitados dedicada con acceso exclusivo a Internet, sin acceso a los sistemas internos. Esto se alinea con los requisitos de PCI DSS para el aislamiento del entorno de datos de los titulares de tarjetas y las prácticas generales de seguridad empresarial. Para obtener más información sobre la arquitectura de segmentación, consulte Gestión de ancho de banda: una guía práctica para 2026 .

Autenticación de respaldo

Si la API de WeChat no está disponible, su portal debe redirigir a un método de inicio de sesión alternativo. No deje a los invitados con una pantalla en blanco. Una alternativa por correo electrónico o SMS garantiza la continuidad. Esto es especialmente importante para establecimientos en entornos de Transporte y Sanidad , donde la conectividad es una obligación del servicio.


Casos de estudio reales

Hostelería: grupo hotelero de lujo

Un hotel de lujo de 400 habitaciones en Londres atiende a una proporción significativa de huéspedes de China continental. Su Captive Portal existente requería una dirección de correo electrónico y verificación por SMS. Los números de móvil chinos suelen tener problemas para recibir SMS de proveedores europeos, y muchos huéspedes no tienen un correo electrónico local configurado en su dispositivo. El resultado fue una tasa de abandono del 60 % en el portal.

El hotel registró una Cuenta de Servicio en la Plataforma de Cuentas Oficiales y una Aplicación Web en la Plataforma Abierta. El portal detecta el agente de usuario MicroMessenger y activa snsapi_base para los usuarios del navegador integrado en la aplicación, conectándolos en menos de tres segundos sin pantalla de consentimiento. Los huéspedes que llegan a través de Chrome o Safari ven un código QR. En estancias posteriores, se reconoce el mismo OpenID y se vuelve a autenticar al huésped de forma silenciosa. El CRM del hotel registra la visita de regreso, lo que permite comunicaciones personalizadas antes de la llegada. Para obtener más información sobre la implementación de WiFi en entornos hoteleros, consulte Hostelería .

Comercio minorista: análisis de centros comerciales

Un gran centro comercial quiere recopilar datos demográficos de los compradores chinos para fundamentar las decisiones de marketing y la combinación de inquilinos. Necesitan la ciudad de origen, el género y la frecuencia de las visitas. snsapi_base es insuficiente: necesitan snsapi_userinfo. El portal solicita el alcance completo de userinfo. El invitado ve una pantalla de consentimiento de WeChat y pulsa Permitir. La plataforma de análisis del centro comercial, integrada con WiFi Analytics de Purple, recibe un flujo de datos demográficos verificados. Los sábados por la tarde, el 40 % de los usuarios de WiFi proceden de una región específica. Esos datos directe informa sobre a qué marcas dirigirse para eventos pop-up. Para más información sobre despliegues de WiFi en el sector minorista, consulte comercio minorista .


Resolución de problemas y mitigación de riesgos

Los cinco modos de fallo más comunes en los despliegues de Captive Portal con OAuth de WeChat son los siguientes.

Discrepancia en la URI de redirección (error 40029). WeChat valida la URI de redirección con el dominio registrado. Cualquier discrepancia en el subdominio, la ruta o el protocolo hará que falle el intercambio de códigos. Registre todas las variantes, incluidos los entornos de pruebas (staging).

Exposición de AppSecret. Integrar el AppSecret en el código del lado del cliente es el error de seguridad más grave. Mueva toda la lógica de intercambio de tokens al servidor.

Falta de protección CSRF. Omitir la validación del parámetro state deja al portal vulnerable a la falsificación de peticiones en sitios cruzados (CSRF). Genere un valor criptográficamente aleatorio por sesión y valídelo en la llamada de retorno (callback).

Fallo en la detección del navegador integrado (in-app). No detectar MicroMessenger en el agente de usuario (user agent) significa que a los usuarios del navegador integrado se les ofrece un flujo de OAuth incorrecto, lo que genera errores.

La aleatorización de direcciones MAC interrumpe las sesiones MAB. Los sistemas operativos móviles modernos aleatorizan las direcciones MAC. Los invitados que utilicen la autenticación basada en MAB perderán su sesión al volver a conectarse. Actualice a RADIUS CoA para una gestión de sesiones fiable. Para obtener orientación sobre la configuración segura de WiFi, consulte Qué es un WiFi seguro: Guía esencial para empresas 2026 .


ROI e impacto empresarial

La implementación de la funcionalidad de WiFi para invitados con inicio de sesión de WeChat tiene tres impactos medibles.

Mayor tasa de autenticación. Eliminar el punto de fallo de la verificación por SMS y el requisito de introducir el correo electrónico aumenta el porcentaje de visitantes chinos que se conectan correctamente. Una tasa de abandono del 60% es una base de referencia realista para los portales que no son compatibles con WeChat.

Calidad de los datos de primera mano (first-party data). Los perfiles autenticados con WeChat incluyen un OpenID verificado y, con snsapi_userinfo, atributos demográficos obtenidos directamente de la plataforma social. Estos datos se integran en las plataformas de analítica para impulsar un marketing segmentado sin depender de cookies de terceros.

Reducción de los costes de soporte. El inicio de sesión sin fricciones reduce las llamadas de soporte a recepción y al departamento de TI por parte de clientes internacionales que intentan solucionar problemas de conexión.

Purple opera en más de 80.000 establecimientos y procesó 440 millones de inicios de sesión en 2024 (datos internos de Purple). La plataforma cuenta con la certificación ISO 27001, cumple con el GDPR y la CCPA, y mantiene un tiempo de actividad del 99,999%. Para los establecimientos de los sectores de comercio minorista y hostelería , la autenticación de WeChat transforma la red de un centro de costes a un canal fiable de adquisición de datos de primera mano.

Definiciones clave

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.

Ejemplos prácticos

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.

Comentario del examinador: 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.

Comentario del examinador: 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.

Preguntas de práctica

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?

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

Ver respuesta modelo

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?

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

Ver respuesta modelo

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?

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

Ver respuesta modelo

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?

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

Ver respuesta modelo

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.