Portal internet access on successful connection. #549
Replies: 3 comments 1 reply
-
@feliks912, Thank you for using AutoConnect. I will explore as some solutions as possible to meet your needs. The ESP32 (also ESP8266) has a WiFi implementation with two different roles. One realizes a Soft AP and the other constitutes a WiFi station. The TCP stacks of Soft AP and the WiFi station are independent and have separate IP addresses. In the situation where you open a captive portal with the ESP module, the IP address of the ESP module is in the following state. The connection request is issued from the web page displayed on your client device. (i.e. HTTP GET) The response to this GET request is pending for the duration of the connection attempt. When a client device successfully connects to a WiFi access point, the ESP32's WiFi Station will have a data link between your requested access points. However, your client device will still maintain a data link to the ESP32 WiFi AP (SoftAP). And these two routes do not belong to the same network segment. Some constraints should be clarified from your request
Implementation ModelsI have illustrated below what I understand based on your reference. Is this what you are trying to say?
I am sure my understanding has not caught up with you, so please bear with me on that. It would be helpful if you could provide a little more specific flow. Thank you. |
Beta Was this translation helpful? Give feedback.
-
@feliks912 Do you simply want to configure a so-called device flow using an ESP module (i.e., a devices that have limited input capabilities with an embedded ESP module) based on the premise of OAuth2.0 RFC6749? If so, in the quote from the RFC below, where does the captive portal produced by SoftAP of the ESP module appear in (A) through (D)? And how does that relate to following your mention? In particular, what does ESP tunnel internet connection mean?
Or are you assuming the above sequence (C) as a network connection from the end user's secondary device to the ESP's SoftAP? And you want to use a captive portal gimmick to automatically pop up a login page and redirect to a validation URI? If so, the [End User at Browser] device (i.e., secondary device) shown in sequence (C) and (D) above would have two different segment IP addresses, one for the ESP's SoftAP connection and one for the Authorization Server connection (i.e., IP address connected to the Internet). Can your secondary device do that trick? |
Beta Was this translation helpful? Give feedback.
-
Thank You for Your answer Mr. Hieromon. You are exact on the second one. The ESP32 is the limited device. We need it to use Google API to talk to Firebase and handle data. The operational sequence is as follows:
A caricature of the implementation model: User must access google.com without leaving the portal. I don't know if I must do that in software or if MESH can be supported using AutoConnect / in conjunction with AutoConnect's portal running. Seems like a rudimentary function, but it's timing and the fact the user can't be disconnected from the AP in the first place that, as far as I see, makes it complex. Is it possible to do such a thing while also using AutoConnect? Thank You for your detailed approach. *Alternatively user gets directed to a temporary page until Google responds with the codes, after which they get sent to /_ac/googleLogin |
Beta Was this translation helpful? Give feedback.
-
Hello Mr. Hieromon, thank You for Your work. This is such an amazing library our college professor wants to use it it as a de-facto ESP solution for our current, and future projects.
I have stumbled upon the following problem. The code below sets Autoconnect up so /_ac/googleLogin is displayed upon a successful WiFi connection. There, a button with Javascript copies a defined string to clipboard and redirects users to an outside URL, i.e. YouTube.com. It works except users don't have internet connection when they click the button, and the page can't load.
Assuming users don't use LTE in the process, and rely only on the connection made to the ESP SoftAP when accessing the site, can the ESP tunnel internet connection from a connected network to the existing softAP, retaining full captive portal functionality (specifically login to network prompt)? I'm looking to pass the internet connection to the user.
I've read Preserving AP mode and Inside AutoConnect::begin. Preserve AP only works when autoRise is set to false, which stops Captive portal's 'login to network', a feature we are looking for. Is there a way to retain it, keep the portal active after a connection to the network is made (retainPortal), and enable internet access such that, when the user clicks the URL on the success screen, they can access internet sites?
A practical use-case would be authenticating limited-input devices with Google where, upon a successful internet connection, ESP makes an API request, gets the keys, edits the URL and STRING variables in text json and allows users to access Google's device authentication portal through one click.
I played around with re-configuring the AP after Portal.begin() returns, but that disconnects the user even when all parameters are the same as the one they are connected to (ip, ssid, password, gateway).
Thank You very much in advance,
Feliks Mihelj
Beta Was this translation helpful? Give feedback.
All reactions