tripflex / WifiWizard2

A Cordova plugin for managing Wifi networks (new version of WiFiWizard) - Latest is version 3+

Home Page:https://www.npmjs.com/package/cordova-plugin-wifiwizard2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

force check key

Hippoi opened this issue · comments

Hello, I have the following problem, if I try to connect with a wifi that I was previously connected to and for that the smartphone already has the password, it always connects despite putting the wrong password.

I do not know what I have to do to force not to connect if the key is wrong.

This is because in newer version of android (which should be majority unless running really old devices), you can not update, remove, or disable networks that were not created/setup by your application.

See here:
https://github.com/tripflex/WifiWizard2/tree/3.0.0#android-permissions-and-notes

I'm curious though ... in what kind of use case scenario would you not want to connect to wifi network ... especially if it already has the correct password in the phone?

thanks

I have an app that should send an ESP8266 device the name of the SSID and its correct password. For this I have two text fields one for the ssid and another for the password,
In order to check that the data has been correctly entered I connect to the internet, but if the password is wrong, it also connects since the correct password is stored somewhere.

I sent the data to the ssid of the text fields and if the password is bad, I sent it wrong.

@tripflex IOT based devices in which you are only wanting a one-time connection to be established are reasons why. It is why I had the weird disable/remove network stuff in my plugin.

@arsenal942 what are your thoughts regrading this then? For my iot stuff I have it handled by the device itself, esp8266 and esp32, and just make an RPC call to the device to see if it connected to the internet or not.

I guess we could add a helper method that just tests creds, connects and returns promise is successful, reject if not, and remove after connecting?

@Hippoi I am currently facing a similar scenario in which I want to send WiFi credentials to an IoT device.

I think the verification of credentials (resp. the overall check whether a connection could be established or not) should be done on device side. Besides wrong credentials, there are other factors that could prevent a successful connection (e.g. if the WiFi has been set up as 5 GHz but the IoT device supports 2.4 GHz only).

Pre-checking the credentials on client-side might result in multiple points of failure. I would therefore recommend to test the connection on device side and return an appropriate status code.

@xLarry yes I agree, that's actually why I wrote this library for Mongoose OS to handle this specific situation as you are completely right, there's so many other factors that could come into play
https://github.com/tripflex/wifi-captive-portal