Android Question UserAndPasswordRequired event is never raised

FrenchDeveloper

Member
Licensed User
Longtime User

Attachments

  • UserAndPasswordRequiredTest.zip
    12.4 KB · Views: 255

Erel

B4X founder
Staff member
Licensed User
Longtime User
UserAndPasswordRequired event is raised when there is a site that uses basic authentication.

The links you posted do not use it.

Basic authentication looks like:

SS-2017-02-05_08.31.45.png
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
it is possible to post your credentials to a webview, BUT there are some things to take in consideration:

1) does the website return a cookie on successful login?
2) websites requiring a login will usually require you to log in every time you access their site. (at most, they might offer to keep your id as a cookie). what this means is that you will send your credentials each time by posting them, but you won't actually have to key them it. do you understand that? so, instead of using the usual webview.loadurl( "http://stat.jagdverband.it/index.php" ), you will have to use a different loadurl() method which is not currently exposed in the b4a webview. it loads the webview plus sends the credentials "automatically")
3) the above only works if the site is using the post method to accept the credentials.
4) the special loadurl() method should not be difficult to implement. i use it in a library of mine. it should be simple enough to implement using javaobject.
5) note: the special loadurl() method would be hardcoded for jagdverband.it alone. if you're thinking of using this scheme on a list of sites that you visit, then you need to approach things a little differently. but the actual loading of the page would still use the special method. parameters would be handled differently.

i have tested with a site that requires a login, so i know it can work.
in theory, none of this is difficult. you might need help with using a javaobject, but the rest involves planning. most important, do you understand, conceptually, what i'm talking about? there's no sense getting into details if you don't.
 
Upvote 0
Top